status-go/geth-patches/0008-tx-pool-nonce.patch

20 lines
887 B
Diff

diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index 362379cc..6e12e500 100644
--- a/internal/ethapi/api.go
+++ b/internal/ethapi/api.go
@@ -956,6 +956,14 @@ func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex(ctx cont
// GetTransactionCount returns the number of transactions the given address has sent for the given block number
func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error) {
+ // go-ethereum issue https://github.com/ethereum/go-ethereum/issues/2880
+ if blockNr == rpc.PendingBlockNumber {
+ nonce, err := s.b.GetPoolNonce(ctx, address)
+ if err != nil {
+ return nil, err
+ }
+ return (*hexutil.Uint64)(&nonce), nil
+ }
state, _, err := s.b.StateAndHeaderByNumber(ctx, blockNr)
if state == nil || err != nil {
return nil, err