Trait TransactionPool
pub trait TransactionPool:
Send
+ Sync
+ Clone {
type Transaction: EthPoolTransaction;
Show 57 methods
// Required methods
fn pool_size(&self) -> PoolSize;
fn block_info(&self) -> BlockInfo;
fn add_transaction_and_subscribe(
&self,
origin: TransactionOrigin,
transaction: Self::Transaction,
) -> impl Future<Output = Result<TransactionEvents, PoolError>> + Send;
fn add_transaction(
&self,
origin: TransactionOrigin,
transaction: Self::Transaction,
) -> impl Future<Output = Result<FixedBytes<32>, PoolError>> + Send;
fn add_transactions(
&self,
origin: TransactionOrigin,
transactions: Vec<Self::Transaction>,
) -> impl Future<Output = Vec<Result<FixedBytes<32>, PoolError>>> + Send;
fn transaction_event_listener(
&self,
tx_hash: FixedBytes<32>,
) -> Option<TransactionEvents>;
fn all_transactions_event_listener(
&self,
) -> AllTransactionsEvents<Self::Transaction>;
fn pending_transactions_listener_for(
&self,
kind: TransactionListenerKind,
) -> Receiver<FixedBytes<32>>;
fn blob_transaction_sidecars_listener(&self) -> Receiver<NewBlobSidecar>;
fn new_transactions_listener_for(
&self,
kind: TransactionListenerKind,
) -> Receiver<NewTransactionEvent<Self::Transaction>>;
fn pooled_transaction_hashes(&self) -> Vec<FixedBytes<32>>;
fn pooled_transaction_hashes_max(&self, max: usize) -> Vec<FixedBytes<32>>;
fn pooled_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn pooled_transactions_max(
&self,
max: usize,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn get_pooled_transaction_elements(
&self,
tx_hashes: Vec<FixedBytes<32>>,
limit: GetPooledTransactionLimit,
) -> Vec<<Self::Transaction as PoolTransaction>::Pooled>;
fn get_pooled_transaction_element(
&self,
tx_hash: FixedBytes<32>,
) -> Option<RecoveredTx<<Self::Transaction as PoolTransaction>::Pooled>>;
fn best_transactions(
&self,
) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>>;
fn best_transactions_with_attributes(
&self,
best_transactions_attributes: BestTransactionsAttributes,
) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>>;
fn pending_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn pending_transactions_max(
&self,
max: usize,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn queued_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn all_transactions(&self) -> AllPoolTransactions<Self::Transaction>;
fn remove_transactions(
&self,
hashes: Vec<FixedBytes<32>>,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn remove_transactions_and_descendants(
&self,
hashes: Vec<FixedBytes<32>>,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn remove_transactions_by_sender(
&self,
sender: Address,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn retain_unknown<A>(&self, announcement: &mut A)
where A: HandleMempoolData;
fn get(
&self,
tx_hash: &FixedBytes<32>,
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn get_all(
&self,
txs: Vec<FixedBytes<32>>,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn on_propagated(&self, txs: PropagatedTransactions);
fn get_transactions_by_sender(
&self,
sender: Address,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn get_pending_transactions_with_predicate(
&self,
predicate: impl FnMut(&ValidPoolTransaction<Self::Transaction>) -> bool,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn get_pending_transactions_by_sender(
&self,
sender: Address,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn get_queued_transactions_by_sender(
&self,
sender: Address,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn get_highest_transaction_by_sender(
&self,
sender: Address,
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn get_highest_consecutive_transaction_by_sender(
&self,
sender: Address,
on_chain_nonce: u64,
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn get_transaction_by_sender_and_nonce(
&self,
sender: Address,
nonce: u64,
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn get_transactions_by_origin(
&self,
origin: TransactionOrigin,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn get_pending_transactions_by_origin(
&self,
origin: TransactionOrigin,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn unique_senders(&self) -> HashSet<Address>;
fn get_blob(
&self,
tx_hash: FixedBytes<32>,
) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError>;
fn get_all_blobs(
&self,
tx_hashes: Vec<FixedBytes<32>>,
) -> Result<Vec<(FixedBytes<32>, Arc<BlobTransactionSidecar>)>, BlobStoreError>;
fn get_all_blobs_exact(
&self,
tx_hashes: Vec<FixedBytes<32>>,
) -> Result<Vec<Arc<BlobTransactionSidecar>>, BlobStoreError>;
fn get_blobs_for_versioned_hashes(
&self,
versioned_hashes: &[FixedBytes<32>],
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>;
// Provided methods
fn add_external_transaction(
&self,
transaction: Self::Transaction,
) -> impl Future<Output = Result<FixedBytes<32>, PoolError>> + Send { ... }
fn add_external_transactions(
&self,
transactions: Vec<Self::Transaction>,
) -> impl Future<Output = Vec<Result<FixedBytes<32>, PoolError>>> + Send { ... }
fn pending_transactions_listener(&self) -> Receiver<FixedBytes<32>> { ... }
fn new_transactions_listener(
&self,
) -> Receiver<NewTransactionEvent<Self::Transaction>> { ... }
fn new_pending_pool_transactions_listener(
&self,
) -> NewSubpoolTransactionStream<Self::Transaction> { ... }
fn new_basefee_pool_transactions_listener(
&self,
) -> NewSubpoolTransactionStream<Self::Transaction> { ... }
fn new_queued_transactions_listener(
&self,
) -> NewSubpoolTransactionStream<Self::Transaction> { ... }
fn contains(&self, tx_hash: &FixedBytes<32>) -> bool { ... }
fn get_local_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> { ... }
fn get_private_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> { ... }
fn get_external_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> { ... }
fn get_local_pending_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> { ... }
fn get_private_pending_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> { ... }
fn get_external_pending_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> { ... }
}
Expand description
General purpose abstraction of a transaction-pool.
This is intended to be used by API-consumers such as RPC that need inject new incoming, unverified transactions. And by block production that needs to get transactions to execute in a new block.
Note: This requires Clone
for convenience, since it is assumed that this will be implemented
for a wrapped Arc
type, see also Pool
.
Required Associated Types§
type Transaction: EthPoolTransaction
type Transaction: EthPoolTransaction
The transaction type of the pool
Required Methods§
fn block_info(&self) -> BlockInfo
fn block_info(&self) -> BlockInfo
Returns the block the pool is currently tracking.
This tracks the block that the pool has last seen.
fn add_transaction_and_subscribe(
&self,
origin: TransactionOrigin,
transaction: Self::Transaction,
) -> impl Future<Output = Result<TransactionEvents, PoolError>> + Send
fn add_transaction_and_subscribe( &self, origin: TransactionOrigin, transaction: Self::Transaction, ) -> impl Future<Output = Result<TransactionEvents, PoolError>> + Send
Adds an unvalidated transaction into the pool and subscribe to state changes.
This is the same as TransactionPool::add_transaction
but returns an event stream for the
given transaction.
Consumer: Custom
fn add_transaction(
&self,
origin: TransactionOrigin,
transaction: Self::Transaction,
) -> impl Future<Output = Result<FixedBytes<32>, PoolError>> + Send
fn add_transaction( &self, origin: TransactionOrigin, transaction: Self::Transaction, ) -> impl Future<Output = Result<FixedBytes<32>, PoolError>> + Send
Adds an unvalidated transaction into the pool.
Consumer: RPC
fn add_transactions(
&self,
origin: TransactionOrigin,
transactions: Vec<Self::Transaction>,
) -> impl Future<Output = Vec<Result<FixedBytes<32>, PoolError>>> + Send
fn add_transactions( &self, origin: TransactionOrigin, transactions: Vec<Self::Transaction>, ) -> impl Future<Output = Vec<Result<FixedBytes<32>, PoolError>>> + Send
Adds the given unvalidated transaction into the pool.
Returns a list of results.
Consumer: RPC
fn transaction_event_listener(
&self,
tx_hash: FixedBytes<32>,
) -> Option<TransactionEvents>
fn transaction_event_listener( &self, tx_hash: FixedBytes<32>, ) -> Option<TransactionEvents>
Returns a new transaction change event stream for the given transaction.
Returns None
if the transaction is not in the pool.
fn all_transactions_event_listener(
&self,
) -> AllTransactionsEvents<Self::Transaction>
fn all_transactions_event_listener( &self, ) -> AllTransactionsEvents<Self::Transaction>
Returns a new transaction change event stream for all transactions in the pool.
fn pending_transactions_listener_for(
&self,
kind: TransactionListenerKind,
) -> Receiver<FixedBytes<32>>
fn pending_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> Receiver<FixedBytes<32>>
Returns a new [Receiver] that yields transactions hashes for new pending transactions inserted into the pending pool depending on the given TransactionListenerKind argument.
fn blob_transaction_sidecars_listener(&self) -> Receiver<NewBlobSidecar>
fn blob_transaction_sidecars_listener(&self) -> Receiver<NewBlobSidecar>
Returns a new [Receiver] that yields blob “sidecars” (blobs w/ assoc. kzg commitments/proofs) for eip-4844 transactions inserted into the pool
fn new_transactions_listener_for(
&self,
kind: TransactionListenerKind,
) -> Receiver<NewTransactionEvent<Self::Transaction>>
fn new_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> Receiver<NewTransactionEvent<Self::Transaction>>
Returns a new stream that yields new valid transactions added to the pool depending on the given TransactionListenerKind argument.
fn pooled_transaction_hashes(&self) -> Vec<FixedBytes<32>>
fn pooled_transaction_hashes(&self) -> Vec<FixedBytes<32>>
Returns the hashes of all transactions in the pool.
Note: This returns a Vec
but should guarantee that all hashes are unique.
Consumer: P2P
fn pooled_transaction_hashes_max(&self, max: usize) -> Vec<FixedBytes<32>>
fn pooled_transaction_hashes_max(&self, max: usize) -> Vec<FixedBytes<32>>
Returns only the first max
hashes of transactions in the pool.
Consumer: P2P
fn pooled_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn pooled_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns the full transaction objects all transactions in the pool.
This is intended to be used by the network for the initial exchange of pooled transaction hashes
Note: This returns a Vec
but should guarantee that all transactions are unique.
Caution: In case of blob transactions, this does not include the sidecar.
Consumer: P2P
fn pooled_transactions_max(
&self,
max: usize,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn pooled_transactions_max( &self, max: usize, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns only the first max
transactions in the pool.
Consumer: P2P
fn get_pooled_transaction_elements(
&self,
tx_hashes: Vec<FixedBytes<32>>,
limit: GetPooledTransactionLimit,
) -> Vec<<Self::Transaction as PoolTransaction>::Pooled>
fn get_pooled_transaction_elements( &self, tx_hashes: Vec<FixedBytes<32>>, limit: GetPooledTransactionLimit, ) -> Vec<<Self::Transaction as PoolTransaction>::Pooled>
Returns converted PooledTransaction for the given transaction hashes.
This adheres to the expected behavior of
GetPooledTransactions
:
The transactions must be in same order as in the request, but it is OK to skip transactions which are not available.
If the transaction is a blob transaction, the sidecar will be included.
Consumer: P2P
fn get_pooled_transaction_element(
&self,
tx_hash: FixedBytes<32>,
) -> Option<RecoveredTx<<Self::Transaction as PoolTransaction>::Pooled>>
fn get_pooled_transaction_element( &self, tx_hash: FixedBytes<32>, ) -> Option<RecoveredTx<<Self::Transaction as PoolTransaction>::Pooled>>
Returns the pooled transaction variant for the given transaction hash.
This adheres to the expected behavior of
GetPooledTransactions
:
If the transaction is a blob transaction, the sidecar will be included.
It is expected that this variant represents the valid p2p format for full transactions. E.g. for EIP-4844 transactions this is the consensus transaction format with the blob sidecar.
Consumer: P2P
fn best_transactions(
&self,
) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>>
fn best_transactions( &self, ) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>>
Returns an iterator that yields transactions that are ready for block production.
Consumer: Block production
fn best_transactions_with_attributes(
&self,
best_transactions_attributes: BestTransactionsAttributes,
) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>>
fn best_transactions_with_attributes( &self, best_transactions_attributes: BestTransactionsAttributes, ) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>>
Returns an iterator that yields transactions that are ready for block production with the given base fee and optional blob fee attributes.
Consumer: Block production
fn pending_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all transactions that can be included in the next block.
This is primarily used for the txpool_
RPC namespace:
https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool which distinguishes
between pending
and queued
transactions, where pending
are transactions ready for
inclusion in the next block and queued
are transactions that are ready for inclusion in
future blocks.
Consumer: RPC
fn pending_transactions_max(
&self,
max: usize,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn pending_transactions_max( &self, max: usize, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns first max
transactions that can be included in the next block.
See https://github.com/paradigmxyz/reth/issues/12767#issuecomment-2493223579
Consumer: Block production
fn queued_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn queued_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all transactions that can be included in future blocks.
This and Self::pending_transactions are mutually exclusive.
Consumer: RPC
fn all_transactions(&self) -> AllPoolTransactions<Self::Transaction>
fn all_transactions(&self) -> AllPoolTransactions<Self::Transaction>
Returns all transactions that are currently in the pool grouped by whether they are ready for inclusion in the next block or not.
This is primarily used for the txpool_
namespace: https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool
Consumer: RPC
fn remove_transactions(
&self,
hashes: Vec<FixedBytes<32>>,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn remove_transactions( &self, hashes: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Removes all transactions corresponding to the given hashes.
Consumer: Utility
fn remove_transactions_and_descendants(
&self,
hashes: Vec<FixedBytes<32>>,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn remove_transactions_and_descendants( &self, hashes: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Removes all transactions corresponding to the given hashes.
Also removes all dependent transactions.
Consumer: Utility
fn remove_transactions_by_sender(
&self,
sender: Address,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn remove_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Removes all transactions from the given sender
Consumer: Utility
fn retain_unknown<A>(&self, announcement: &mut A)where
A: HandleMempoolData,
fn retain_unknown<A>(&self, announcement: &mut A)where
A: HandleMempoolData,
Retains only those hashes that are unknown to the pool. In other words, removes all transactions from the given set that are currently present in the pool. Returns hashes already known to the pool.
Consumer: P2P
fn get(
&self,
tx_hash: &FixedBytes<32>,
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get( &self, tx_hash: &FixedBytes<32>, ) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns the transaction for the given hash.
fn get_all(
&self,
txs: Vec<FixedBytes<32>>,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_all( &self, txs: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all transactions objects for the given hashes.
Caution: This in case of blob transactions, this does not include the sidecar.
fn on_propagated(&self, txs: PropagatedTransactions)
fn on_propagated(&self, txs: PropagatedTransactions)
Notify the pool about transactions that are propagated to peers.
Consumer: P2P
fn get_transactions_by_sender(
&self,
sender: Address,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all transactions sent by a given user
fn get_pending_transactions_with_predicate(
&self,
predicate: impl FnMut(&ValidPoolTransaction<Self::Transaction>) -> bool,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_pending_transactions_with_predicate( &self, predicate: impl FnMut(&ValidPoolTransaction<Self::Transaction>) -> bool, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all pending transactions filtered by predicate
fn get_pending_transactions_by_sender(
&self,
sender: Address,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_pending_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all pending transactions sent by a given user
fn get_queued_transactions_by_sender(
&self,
sender: Address,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_queued_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all queued transactions sent by a given user
fn get_highest_transaction_by_sender(
&self,
sender: Address,
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_highest_transaction_by_sender( &self, sender: Address, ) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns the highest transaction sent by a given user
fn get_highest_consecutive_transaction_by_sender(
&self,
sender: Address,
on_chain_nonce: u64,
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_highest_consecutive_transaction_by_sender( &self, sender: Address, on_chain_nonce: u64, ) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns the transaction with the highest nonce that is executable given the on chain nonce. In other words the highest non nonce gapped transaction.
Note: The next pending pooled transaction must have the on chain nonce.
For example, for a given on chain nonce of 5
, the next transaction must have that nonce.
If the pool contains txs [5,6,7]
this returns tx 7
.
If the pool contains txs [6,7]
this returns None
because the next valid nonce (5) is
missing, which means txs [6,7]
are nonce gapped.
fn get_transaction_by_sender_and_nonce(
&self,
sender: Address,
nonce: u64,
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_transaction_by_sender_and_nonce( &self, sender: Address, nonce: u64, ) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns a transaction sent by a given user and a nonce
fn get_transactions_by_origin(
&self,
origin: TransactionOrigin,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_transactions_by_origin( &self, origin: TransactionOrigin, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all transactions that where submitted with the given TransactionOrigin
fn get_pending_transactions_by_origin(
&self,
origin: TransactionOrigin,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_pending_transactions_by_origin( &self, origin: TransactionOrigin, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all pending transactions filtered by TransactionOrigin
fn unique_senders(&self) -> HashSet<Address>
fn unique_senders(&self) -> HashSet<Address>
Returns a set of all senders of transactions in the pool
fn get_blob(
&self,
tx_hash: FixedBytes<32>,
) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_blob( &self, tx_hash: FixedBytes<32>, ) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError>
Returns the BlobTransactionSidecar for the given transaction hash if it exists in the blob store.
fn get_all_blobs(
&self,
tx_hashes: Vec<FixedBytes<32>>,
) -> Result<Vec<(FixedBytes<32>, Arc<BlobTransactionSidecar>)>, BlobStoreError>
fn get_all_blobs( &self, tx_hashes: Vec<FixedBytes<32>>, ) -> Result<Vec<(FixedBytes<32>, Arc<BlobTransactionSidecar>)>, BlobStoreError>
Returns all BlobTransactionSidecar for the given transaction hashes if they exists in the blob store.
This only returns the blobs that were found in the store. If there’s no blob it will not be returned.
fn get_all_blobs_exact(
&self,
tx_hashes: Vec<FixedBytes<32>>,
) -> Result<Vec<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_all_blobs_exact( &self, tx_hashes: Vec<FixedBytes<32>>, ) -> Result<Vec<Arc<BlobTransactionSidecar>>, BlobStoreError>
Returns the exact BlobTransactionSidecar for the given transaction hashes in the order they were requested.
Returns an error if any of the blobs are not found in the blob store.
fn get_blobs_for_versioned_hashes(
&self,
versioned_hashes: &[FixedBytes<32>],
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>
fn get_blobs_for_versioned_hashes( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>
Return the BlobTransactionSidecar
s for a list of blob versioned hashes.
Provided Methods§
fn add_external_transaction(
&self,
transaction: Self::Transaction,
) -> impl Future<Output = Result<FixedBytes<32>, PoolError>> + Send
fn add_external_transaction( &self, transaction: Self::Transaction, ) -> impl Future<Output = Result<FixedBytes<32>, PoolError>> + Send
Imports an external transaction.
This is intended to be used by the network to insert incoming transactions received over the p2p network.
Consumer: P2P
fn add_external_transactions(
&self,
transactions: Vec<Self::Transaction>,
) -> impl Future<Output = Vec<Result<FixedBytes<32>, PoolError>>> + Send
fn add_external_transactions( &self, transactions: Vec<Self::Transaction>, ) -> impl Future<Output = Vec<Result<FixedBytes<32>, PoolError>>> + Send
Imports all external transactions
Consumer: Utility
fn pending_transactions_listener(&self) -> Receiver<FixedBytes<32>>
fn pending_transactions_listener(&self) -> Receiver<FixedBytes<32>>
Returns a new Stream that yields transactions hashes for new pending transactions inserted into the pool that are allowed to be propagated.
Note: This is intended for networking and will only yield transactions that are allowed to be propagated over the network, see also TransactionListenerKind.
Consumer: RPC/P2P
fn new_transactions_listener(
&self,
) -> Receiver<NewTransactionEvent<Self::Transaction>>
fn new_transactions_listener( &self, ) -> Receiver<NewTransactionEvent<Self::Transaction>>
Returns a new stream that yields new valid transactions added to the pool.
fn new_pending_pool_transactions_listener(
&self,
) -> NewSubpoolTransactionStream<Self::Transaction>
fn new_pending_pool_transactions_listener( &self, ) -> NewSubpoolTransactionStream<Self::Transaction>
Returns a new Stream that yields new transactions added to the pending sub-pool.
This is a convenience wrapper around Self::new_transactions_listener that filters for SubPool::Pending.
fn new_basefee_pool_transactions_listener(
&self,
) -> NewSubpoolTransactionStream<Self::Transaction>
fn new_basefee_pool_transactions_listener( &self, ) -> NewSubpoolTransactionStream<Self::Transaction>
Returns a new Stream that yields new transactions added to the basefee sub-pool.
This is a convenience wrapper around Self::new_transactions_listener that filters for SubPool::BaseFee.
fn new_queued_transactions_listener(
&self,
) -> NewSubpoolTransactionStream<Self::Transaction>
fn new_queued_transactions_listener( &self, ) -> NewSubpoolTransactionStream<Self::Transaction>
Returns a new Stream that yields new transactions added to the queued-pool.
This is a convenience wrapper around Self::new_transactions_listener that filters for SubPool::Queued.
fn contains(&self, tx_hash: &FixedBytes<32>) -> bool
fn contains(&self, tx_hash: &FixedBytes<32>) -> bool
Returns if the transaction for the given hash is already included in this pool.
fn get_local_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_local_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all transactions that where submitted as TransactionOrigin::Local
fn get_private_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_private_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all transactions that where submitted as TransactionOrigin::Private
fn get_external_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_external_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all transactions that where submitted as TransactionOrigin::External
fn get_local_pending_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_local_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all pending transactions that where submitted as TransactionOrigin::Local
fn get_private_pending_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_private_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all pending transactions that where submitted as TransactionOrigin::Private
fn get_external_pending_transactions(
&self,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_external_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns all pending transactions that where submitted as TransactionOrigin::External
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
§impl<'a, T> TransactionPool for &'a T
impl<'a, T> TransactionPool for &'a T
type Transaction = <T as TransactionPool>::Transaction
fn pool_size(&self) -> PoolSize
fn block_info(&self) -> BlockInfo
fn add_external_transaction( &self, transaction: <&'a T as TransactionPool>::Transaction, ) -> impl Future<Output = Result<FixedBytes<32>, PoolError>> + Send
fn add_external_transactions( &self, transactions: Vec<<&'a T as TransactionPool>::Transaction>, ) -> impl Future<Output = Vec<Result<FixedBytes<32>, PoolError>>> + Send
fn add_transaction_and_subscribe( &self, origin: TransactionOrigin, transaction: <&'a T as TransactionPool>::Transaction, ) -> impl Future<Output = Result<TransactionEvents, PoolError>> + Send
fn add_transaction( &self, origin: TransactionOrigin, transaction: <&'a T as TransactionPool>::Transaction, ) -> impl Future<Output = Result<FixedBytes<32>, PoolError>> + Send
fn add_transactions( &self, origin: TransactionOrigin, transactions: Vec<<&'a T as TransactionPool>::Transaction>, ) -> impl Future<Output = Vec<Result<FixedBytes<32>, PoolError>>> + Send
fn transaction_event_listener( &self, tx_hash: FixedBytes<32>, ) -> Option<TransactionEvents>
fn all_transactions_event_listener( &self, ) -> AllTransactionsEvents<<&'a T as TransactionPool>::Transaction>
fn pending_transactions_listener(&self) -> Receiver<FixedBytes<32>>
fn pending_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> Receiver<FixedBytes<32>>
fn new_transactions_listener( &self, ) -> Receiver<NewTransactionEvent<<&'a T as TransactionPool>::Transaction>>
fn blob_transaction_sidecars_listener(&self) -> Receiver<NewBlobSidecar>
fn new_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> Receiver<NewTransactionEvent<<&'a T as TransactionPool>::Transaction>>
fn new_pending_pool_transactions_listener( &self, ) -> NewSubpoolTransactionStream<<&'a T as TransactionPool>::Transaction>
fn new_basefee_pool_transactions_listener( &self, ) -> NewSubpoolTransactionStream<<&'a T as TransactionPool>::Transaction>
fn new_queued_transactions_listener( &self, ) -> NewSubpoolTransactionStream<<&'a T as TransactionPool>::Transaction>
fn pooled_transaction_hashes(&self) -> Vec<FixedBytes<32>>
fn pooled_transaction_hashes_max(&self, max: usize) -> Vec<FixedBytes<32>>
fn pooled_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn pooled_transactions_max( &self, max: usize, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_pooled_transaction_elements( &self, tx_hashes: Vec<FixedBytes<32>>, limit: GetPooledTransactionLimit, ) -> Vec<<<&'a T as TransactionPool>::Transaction as PoolTransaction>::Pooled>
fn get_pooled_transaction_element( &self, tx_hash: FixedBytes<32>, ) -> Option<RecoveredTx<<<&'a T as TransactionPool>::Transaction as PoolTransaction>::Pooled>>
fn best_transactions( &self, ) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>>
fn best_transactions_with_attributes( &self, best_transactions_attributes: BestTransactionsAttributes, ) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>>
fn pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn pending_transactions_max( &self, max: usize, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn queued_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn all_transactions( &self, ) -> AllPoolTransactions<<&'a T as TransactionPool>::Transaction>
fn remove_transactions( &self, hashes: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn remove_transactions_and_descendants( &self, hashes: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn remove_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn retain_unknown<A>(&self, announcement: &mut A)where
A: HandleMempoolData,
fn contains(&self, tx_hash: &FixedBytes<32>) -> bool
fn get( &self, tx_hash: &FixedBytes<32>, ) -> Option<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_all( &self, txs: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn on_propagated(&self, txs: PropagatedTransactions)
fn get_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_pending_transactions_with_predicate( &self, predicate: impl FnMut(&ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>) -> bool, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_pending_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_queued_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_highest_transaction_by_sender( &self, sender: Address, ) -> Option<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_highest_consecutive_transaction_by_sender( &self, sender: Address, on_chain_nonce: u64, ) -> Option<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_transaction_by_sender_and_nonce( &self, sender: Address, nonce: u64, ) -> Option<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_transactions_by_origin( &self, origin: TransactionOrigin, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_pending_transactions_by_origin( &self, origin: TransactionOrigin, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_local_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_private_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_external_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_local_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_private_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn get_external_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<&'a T as TransactionPool>::Transaction>>>
fn unique_senders(&self) -> HashSet<Address>
fn get_blob( &self, tx_hash: FixedBytes<32>, ) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_all_blobs( &self, tx_hashes: Vec<FixedBytes<32>>, ) -> Result<Vec<(FixedBytes<32>, Arc<BlobTransactionSidecar>)>, BlobStoreError>
fn get_all_blobs_exact( &self, tx_hashes: Vec<FixedBytes<32>>, ) -> Result<Vec<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_blobs_for_versioned_hashes( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>
§impl<T> TransactionPool for Arc<T>
impl<T> TransactionPool for Arc<T>
type Transaction = <T as TransactionPool>::Transaction
fn pool_size(&self) -> PoolSize
fn block_info(&self) -> BlockInfo
fn add_external_transaction( &self, transaction: <Arc<T> as TransactionPool>::Transaction, ) -> impl Future<Output = Result<FixedBytes<32>, PoolError>> + Send
fn add_external_transactions( &self, transactions: Vec<<Arc<T> as TransactionPool>::Transaction>, ) -> impl Future<Output = Vec<Result<FixedBytes<32>, PoolError>>> + Send
fn add_transaction_and_subscribe( &self, origin: TransactionOrigin, transaction: <Arc<T> as TransactionPool>::Transaction, ) -> impl Future<Output = Result<TransactionEvents, PoolError>> + Send
fn add_transaction( &self, origin: TransactionOrigin, transaction: <Arc<T> as TransactionPool>::Transaction, ) -> impl Future<Output = Result<FixedBytes<32>, PoolError>> + Send
fn add_transactions( &self, origin: TransactionOrigin, transactions: Vec<<Arc<T> as TransactionPool>::Transaction>, ) -> impl Future<Output = Vec<Result<FixedBytes<32>, PoolError>>> + Send
fn transaction_event_listener( &self, tx_hash: FixedBytes<32>, ) -> Option<TransactionEvents>
fn all_transactions_event_listener( &self, ) -> AllTransactionsEvents<<Arc<T> as TransactionPool>::Transaction>
fn pending_transactions_listener(&self) -> Receiver<FixedBytes<32>>
fn pending_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> Receiver<FixedBytes<32>>
fn new_transactions_listener( &self, ) -> Receiver<NewTransactionEvent<<Arc<T> as TransactionPool>::Transaction>>
fn blob_transaction_sidecars_listener(&self) -> Receiver<NewBlobSidecar>
fn new_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> Receiver<NewTransactionEvent<<Arc<T> as TransactionPool>::Transaction>>
fn new_pending_pool_transactions_listener( &self, ) -> NewSubpoolTransactionStream<<Arc<T> as TransactionPool>::Transaction>
fn new_basefee_pool_transactions_listener( &self, ) -> NewSubpoolTransactionStream<<Arc<T> as TransactionPool>::Transaction>
fn new_queued_transactions_listener( &self, ) -> NewSubpoolTransactionStream<<Arc<T> as TransactionPool>::Transaction>
fn pooled_transaction_hashes(&self) -> Vec<FixedBytes<32>>
fn pooled_transaction_hashes_max(&self, max: usize) -> Vec<FixedBytes<32>>
fn pooled_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn pooled_transactions_max( &self, max: usize, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_pooled_transaction_elements( &self, tx_hashes: Vec<FixedBytes<32>>, limit: GetPooledTransactionLimit, ) -> Vec<<<Arc<T> as TransactionPool>::Transaction as PoolTransaction>::Pooled>
fn get_pooled_transaction_element( &self, tx_hash: FixedBytes<32>, ) -> Option<RecoveredTx<<<Arc<T> as TransactionPool>::Transaction as PoolTransaction>::Pooled>>
fn best_transactions( &self, ) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>>
fn best_transactions_with_attributes( &self, best_transactions_attributes: BestTransactionsAttributes, ) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>>
fn pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn pending_transactions_max( &self, max: usize, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn queued_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn all_transactions( &self, ) -> AllPoolTransactions<<Arc<T> as TransactionPool>::Transaction>
fn remove_transactions( &self, hashes: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn remove_transactions_and_descendants( &self, hashes: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn remove_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn retain_unknown<A>(&self, announcement: &mut A)where
A: HandleMempoolData,
fn contains(&self, tx_hash: &FixedBytes<32>) -> bool
fn get( &self, tx_hash: &FixedBytes<32>, ) -> Option<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_all( &self, txs: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn on_propagated(&self, txs: PropagatedTransactions)
fn get_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_pending_transactions_with_predicate( &self, predicate: impl FnMut(&ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>) -> bool, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_pending_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_queued_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_highest_transaction_by_sender( &self, sender: Address, ) -> Option<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_highest_consecutive_transaction_by_sender( &self, sender: Address, on_chain_nonce: u64, ) -> Option<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_transaction_by_sender_and_nonce( &self, sender: Address, nonce: u64, ) -> Option<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_transactions_by_origin( &self, origin: TransactionOrigin, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_pending_transactions_by_origin( &self, origin: TransactionOrigin, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_local_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_private_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_external_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_local_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_private_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn get_external_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Arc<T> as TransactionPool>::Transaction>>>
fn unique_senders(&self) -> HashSet<Address>
fn get_blob( &self, tx_hash: FixedBytes<32>, ) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_all_blobs( &self, tx_hashes: Vec<FixedBytes<32>>, ) -> Result<Vec<(FixedBytes<32>, Arc<BlobTransactionSidecar>)>, BlobStoreError>
fn get_all_blobs_exact( &self, tx_hashes: Vec<FixedBytes<32>>, ) -> Result<Vec<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_blobs_for_versioned_hashes( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>
Implementors§
§impl TransactionPool for NoopTransactionPool
impl TransactionPool for NoopTransactionPool
type Transaction = EthPooledTransaction
§impl<V, T, S> TransactionPool for Pool<V, T, S>where
V: TransactionValidator,
<V as TransactionValidator>::Transaction: EthPoolTransaction,
T: TransactionOrdering<Transaction = <V as TransactionValidator>::Transaction>,
S: BlobStore,
implements the TransactionPool
interface for various transaction pool API consumers.
impl<V, T, S> TransactionPool for Pool<V, T, S>where
V: TransactionValidator,
<V as TransactionValidator>::Transaction: EthPoolTransaction,
T: TransactionOrdering<Transaction = <V as TransactionValidator>::Transaction>,
S: BlobStore,
implements the TransactionPool
interface for various transaction pool API consumers.