Add txpool_contentFrom JSON-RPC method#10111
Merged
fab-10 merged 1 commit intobesu-eth:mainfrom Mar 27, 2026
Merged
Conversation
0e5e561 to
3dac9e5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Implements the txpool_contentFrom JSON-RPC method to return pending vs queued transactions for a given sender, split by nonce continuity from the sender’s on-chain nonce.
Changes:
- Added
txpool_contentFromto the JSON-RPC method registry andRpcMethodenum. - Extended the transaction pool APIs to retrieve a sender’s transactions and current nonce.
- Added result/handler types plus a new unit test suite validating nonce-gap splitting behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/PendingTransactionsForSender.java | Adds current-nonce accessor and adjusts synchronization while reading sender txs |
| ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/AbstractPendingTransactionsSorter.java | Implements new per-sender pending tx and current nonce retrieval methods |
| ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredPendingTransactions.java | Plumbs per-sender pending tx and current nonce through layered pool implementation |
| ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java | Exposes per-sender pending tx list and current nonce from the pool |
| ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/PendingTransactions.java | Extends interface with per-sender tx retrieval and current-nonce lookup |
| ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/DisabledPendingTransactions.java | Provides empty implementations for new interface methods |
| ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/TxPoolContentFromTest.java | Adds unit tests for txpool_contentFrom behavior |
| ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/TxPoolJsonRpcMethods.java | Registers new TxPoolContentFrom RPC method |
| ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionPoolContentFromResult.java | Adds JSON result type for pending/queued-by-nonce response |
| ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/TxPoolContentFrom.java | Implements txpool_contentFrom handler and nonce-gap splitting logic |
| ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/RpcMethod.java | Adds TX_POOL_CONTENT_FROM enum entry |
.../main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/TxPoolContentFrom.java
Show resolved
Hide resolved
...java/org/hyperledger/besu/ethereum/eth/transactions/sorter/PendingTransactionsForSender.java
Outdated
Show resolved
Hide resolved
.../main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/TxPoolContentFrom.java
Show resolved
Hide resolved
...hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionPoolContentFromResult.java
Show resolved
Hide resolved
...hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionPoolContentFromResult.java
Show resolved
Hide resolved
...hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionPoolContentFromResult.java
Show resolved
Hide resolved
...hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionPoolContentFromResult.java
Show resolved
Hide resolved
01741ac to
1c74e8f
Compare
5 tasks
0f6a35c to
2b57973
Compare
macfarla
approved these changes
Mar 26, 2026
Contributor
macfarla
left a comment
There was a problem hiding this comment.
couple of nits, otherwise LGTM
...org/hyperledger/besu/ethereum/eth/transactions/sorter/AbstractPendingTransactionsSorter.java
Outdated
Show resolved
Hide resolved
...java/org/hyperledger/besu/ethereum/eth/transactions/sorter/PendingTransactionsForSender.java
Show resolved
Hide resolved
Implements the txpool_contentFrom method as defined in the execution-apis spec. Given a sender address, returns the pending (executable) and queued (non-executable) transactions for that address split by nonce continuity from the account's current on-chain nonce. - Add TX_POOL_CONTENT_FROM to RpcMethod enum - Add TxPoolContentFrom handler and TransactionPoolContentFromResult - Register the method in TxPoolJsonRpcMethods - Add getPendingTransactionsForSender and getCurrentNonceForSender to the PendingTransactions interface with implementations in all concrete classes - Add unit tests covering empty pool, all-pending, all-queued, mixed split, absent account nonce, non-zero base nonce, and missing param error cases Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
2b57973 to
67b50b6
Compare
2 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the
txpool_contentFromJSON-RPC method as defined in the execution-apis spec.Given a sender address, returns the pending (executable) and queued (non-executable) transactions for that address, split by nonce continuity from the account's current on-chain nonce.
Example response:
{ "pending": { "0": { "nonce": "0x0", "from": "0x123...", ... }, "1": { "nonce": "0x1", "from": "0x123...", ... } }, "queued": { "3": { "nonce": "0x3", "from": "0x123...", ... } } }Changes
TX_POOL_CONTENT_FROMtoRpcMethodenumTxPoolContentFromhandler andTransactionPoolContentFromResultresult typeTxPoolJsonRpcMethodsgetPendingTransactionsForSender(Address)andgetCurrentNonceForSender(Address)to thePendingTransactionsinterface with implementations inLayeredPendingTransactions,AbstractPendingTransactionsSorter, andDisabledPendingTransactionsTest plan
TxPoolContentFromTestcover:InvalidJsonRpcParameters🤖 Generated with Claude Code