-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a patch with getting nonce from transaction pool
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters