From 7c1d2467dba80ffc66733e7a9b2e2307095fb04d Mon Sep 17 00:00:00 2001 From: jsvisa Date: Thu, 3 Oct 2024 20:37:51 +0800 Subject: [PATCH] core/tracing: GetPoolTransactionBySenderAndNonce Signed-off-by: jsvisa --- core/tracing/hooks.go | 1 + eth/api_backend.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/core/tracing/hooks.go b/core/tracing/hooks.go index 7915a9ca54..26495cd4ff 100644 --- a/core/tracing/hooks.go +++ b/core/tracing/hooks.go @@ -78,6 +78,7 @@ type Backend interface { BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error) GetTransaction(ctx context.Context, txHash common.Hash) (bool, *types.Transaction, common.Hash, uint64, uint64, error) + GetPoolTransactionBySenderAndNonce(sender common.Address, nonce uint64) *types.Transaction ChainConfig() *params.ChainConfig } diff --git a/eth/api_backend.go b/eth/api_backend.go index 8a9898b956..2ab9c484d7 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -304,6 +304,11 @@ func (b *EthAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction return b.eth.txPool.Get(hash) } +// GetPoolTransactionBySenderAndNonce retrieves the pool transaction by the sender and it's nonce +func (b *EthAPIBackend) GetPoolTransactionBySenderAndNonce(sender common.Address, nonce uint64) *types.Transaction { + return b.eth.txPool.GetBySenderAndNonce(sender, nonce) +} + // GetTransaction retrieves the lookup along with the transaction itself associate // with the given transaction hash. //