Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 28 additions & 25 deletions docs/Concepts/Transactions/Transaction-Pool.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
# Transaction Pool
description: Transaction pool overview
<!--- END of page meta data -->

All nodes maintain a transaction pool where pending transactions are stored before they are processed.
# Transaction pool

Options and methods for configuring and monitoring the transaction pool include:
All nodes maintain a transaction pool to store pending transactions before processing.

* [`txpool_besuTransactions`](../../Reference/API-Methods.md#txpool_besutransactions) JSON-RPC API method to list
transactions in the node transaction pool
Options and methods for configuring and monitoring the transaction pool include:

* [`--tx-pool-max-size`](../../Reference/CLI/CLI-Syntax.md#tx-pool-max-size) command line option to specify the maximum number
of transactions in the node transaction pool
* [`txpool_besuTransactions`](../../Reference/API-Methods.md#txpool_besutransactions) JSON-RPC API
method to list transactions in the transaction pool.
* [`--tx-pool-max-size`](../../Reference/CLI/CLI-Syntax.md#tx-pool-max-size) command line option to
specify the maximum number of transactions in the transaction pool.
* [`--tx-pool-retention-hours`](../../Reference/CLI/CLI-Syntax.md#tx-pool-retention-hours) command
line option to specify the maximum number of hours to keep pending transactions in the transaction
pool.
* [`newPendingTransactions`](../../HowTo/Interact/APIs/RPC-PubSub.md#pending-transactions) and
[`droppedPendingTransactions`](../../HowTo/Interact/APIs/RPC-PubSub.md#dropped-transactions)
RPC subscriptions to notify of transactions added to and dropped from the transaction pool.

* [`--tx-pool-retention-hours`](../../Reference/CLI/CLI-Syntax.md#tx-pool-retention-hours) command line option to specify
the maximum number of hours to retain pending transactions in the transaction pool
## Dropping transactions when the transaction pool is full

* [`newPendingTransactions`](../../HowTo/Interact/APIs/RPC-PubSub.md#pending-transactions) and [`droppedPendingTransactions`](../../HowTo/Interact/APIs/RPC-PubSub.md#dropped-transactions)
RPC subscriptions to notify of transactions added to and dropped from the node transaction pool
When the transaction pool is full, it accepts and retains local transactions in preference to
remote transactions. If the transaction pool is full of local transactions, Besu drops the oldest
local transactions first. That is, a full transaction pool continues to accept new local
transactions by first dropping remote transactions and then by dropping the oldest local
transactions.

## Dropping Transactions when Transaction Pool Full
## Replacing transactions with the same sender and nonce

Once full, the Besu transaction pool accepts and retains local transactions in preference to remote transactions.
If the transaction pool is full of local transactions, the oldest local transactions are dropped first. That is, a
full transaction pool continues to accept new local transactions by first dropping remote transactions and then by
dropping the oldest local transactions.
For transactions received with the same sender and nonce as a pending transaction but a higher gas
price, Besu replaces the pending transaction with the new one with the higher gas price.

## Replacing Transactions with Same Nonce
## Size of the transaction pool

If a transaction is received with the same sender and nonce as a pending transaction but a higher gas price, the pending transaction
is replaced by the new one with the higher gas price.

## Size of Transaction Pool

Decreasing the maximum size of the transaction pool reduces memory use. If the network is busy and there is a backlog
of transactions, increasing the size of the transaction pool reduces the risk of transactions being
removed from the transaction pool.
Decreasing the maximum size of the transaction pool reduces memory use. If the network is busy and
there is a backlog of transactions, increasing the size of the transaction pool reduces the risk of
removing transactions from the transaction pool.
30 changes: 16 additions & 14 deletions docs/Concepts/Transactions/Transaction-Validation.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
description: What transaction validation is performed when
description: What transaction validation and when
<!--- END of page meta data -->

# Validating Transactions
# Validating transactions

When transactions are submitted and added to a block, validations are performed as illustrated.
For transactions submitted and added to a block, Besu validates the transactions, as illustrated in
the following diagram.

![Transaction Validation](../../images/transaction-validation.png)

The set of transaction pool validations are repeated when the transaction is propagated. The same set of
validations are repeated when the block including the transaction is imported except the nonce must be
exactly right when importing the block.
Besu repeats the set of transaction pool validations after propagating the transaction. Besu
repeats the same set of validations when importing the block that includes the transaction, except
the nonce must be exactly right when importing the block.

When the transaction is added to a block an additional validation is performed to check the transaction gas limit
is less than the remaining block gas limit. After creating a block, the node imports the block and
the transaction pool validations are repeated.
When adding the transaction to a block, Besu performs an additional validation to check that the
transaction gas limit is less than the remaining block gas limit. After creating a block, the node
imports the block and then repeats the transaction pool validations.

!!! important
The transaction is only added if the entire transaction gas limit is less than the remaining gas
for the block. The total gas used by the transaction is not relevant to this validation. That is, if the total gas used
by the transaction is less than the remaining block gas but the transaction gas limit is more than the remaining black
gas, the transaction is not added.
!!! important

The transaction is only added if the entire transaction gas limit is less than the remaining
gas for the block. The total gas used by the transaction is not relevant to this validation.
That is, if the total gas used by the transaction is less than the remaining block gas, but the
transaction gas limit is more than the remaining block gas, the transaction is not added.