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 = PoolResult<TransactionEvents>> + Send;
fn add_transaction(
&self,
origin: TransactionOrigin,
transaction: Self::Transaction,
) -> impl Future<Output = PoolResult<TxHash>> + Send;
fn add_transactions(
&self,
origin: TransactionOrigin,
transactions: Vec<Self::Transaction>,
) -> impl Future<Output = Vec<PoolResult<TxHash>>> + Send;
fn transaction_event_listener(
&self,
tx_hash: TxHash,
) -> Option<TransactionEvents>;
fn all_transactions_event_listener(
&self,
) -> AllTransactionsEvents<Self::Transaction>;
fn pending_transactions_listener_for(
&self,
kind: TransactionListenerKind,
) -> Receiver<TxHash>;
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<TxHash>;
fn pooled_transaction_hashes_max(&self, max: usize) -> Vec<TxHash>;
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<TxHash>,
limit: GetPooledTransactionLimit,
) -> Vec<<Self::Transaction as PoolTransaction>::Pooled>;
fn get_pooled_transaction_element(
&self,
tx_hash: TxHash,
) -> 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<TxHash>,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn remove_transactions_and_descendants(
&self,
hashes: Vec<TxHash>,
) -> 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: &TxHash,
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>;
fn get_all(
&self,
txs: Vec<TxHash>,
) -> 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: TxHash,
) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError>;
fn get_all_blobs(
&self,
tx_hashes: Vec<TxHash>,
) -> Result<Vec<(TxHash, Arc<BlobTransactionSidecar>)>, BlobStoreError>;
fn get_all_blobs_exact(
&self,
tx_hashes: Vec<TxHash>,
) -> Result<Vec<Arc<BlobTransactionSidecar>>, BlobStoreError>;
fn get_blobs_for_versioned_hashes(
&self,
versioned_hashes: &[B256],
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>;
// Provided methods
fn add_external_transaction(
&self,
transaction: Self::Transaction,
) -> impl Future<Output = PoolResult<TxHash>> + Send { ... }
fn add_external_transactions(
&self,
transactions: Vec<Self::Transaction>,
) -> impl Future<Output = Vec<PoolResult<TxHash>>> + Send { ... }
fn pending_transactions_listener(&self) -> Receiver<TxHash> { ... }
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: &TxHash) -> 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§
Sourcetype Transaction: EthPoolTransaction
type Transaction: EthPoolTransaction
The transaction type of the pool
Required Methods§
Sourcefn 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.
Sourcefn add_transaction_and_subscribe(
&self,
origin: TransactionOrigin,
transaction: Self::Transaction,
) -> impl Future<Output = PoolResult<TransactionEvents>> + Send
fn add_transaction_and_subscribe( &self, origin: TransactionOrigin, transaction: Self::Transaction, ) -> impl Future<Output = PoolResult<TransactionEvents>> + 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
Sourcefn add_transaction(
&self,
origin: TransactionOrigin,
transaction: Self::Transaction,
) -> impl Future<Output = PoolResult<TxHash>> + Send
fn add_transaction( &self, origin: TransactionOrigin, transaction: Self::Transaction, ) -> impl Future<Output = PoolResult<TxHash>> + Send
Adds an unvalidated transaction into the pool.
Consumer: RPC
Sourcefn add_transactions(
&self,
origin: TransactionOrigin,
transactions: Vec<Self::Transaction>,
) -> impl Future<Output = Vec<PoolResult<TxHash>>> + Send
fn add_transactions( &self, origin: TransactionOrigin, transactions: Vec<Self::Transaction>, ) -> impl Future<Output = Vec<PoolResult<TxHash>>> + Send
Adds the given unvalidated transaction into the pool.
Returns a list of results.
Consumer: RPC
Sourcefn transaction_event_listener(
&self,
tx_hash: TxHash,
) -> Option<TransactionEvents>
fn transaction_event_listener( &self, tx_hash: TxHash, ) -> Option<TransactionEvents>
Returns a new transaction change event stream for the given transaction.
Returns None
if the transaction is not in the pool.
Sourcefn 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.
Sourcefn pending_transactions_listener_for(
&self,
kind: TransactionListenerKind,
) -> Receiver<TxHash>
fn pending_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> Receiver<TxHash>
Returns a new [Receiver] that yields transactions hashes for new pending transactions inserted into the pending pool depending on the given TransactionListenerKind argument.
Sourcefn 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
Sourcefn 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.
Sourcefn pooled_transaction_hashes(&self) -> Vec<TxHash>
fn pooled_transaction_hashes(&self) -> Vec<TxHash>
Returns the hashes of all transactions in the pool.
Note: This returns a Vec
but should guarantee that all hashes are unique.
Consumer: P2P
Sourcefn pooled_transaction_hashes_max(&self, max: usize) -> Vec<TxHash>
fn pooled_transaction_hashes_max(&self, max: usize) -> Vec<TxHash>
Returns only the first max
hashes of transactions in the pool.
Consumer: P2P
Sourcefn 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
Sourcefn 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
Sourcefn get_pooled_transaction_elements(
&self,
tx_hashes: Vec<TxHash>,
limit: GetPooledTransactionLimit,
) -> Vec<<Self::Transaction as PoolTransaction>::Pooled>
fn get_pooled_transaction_elements( &self, tx_hashes: Vec<TxHash>, 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
Sourcefn get_pooled_transaction_element(
&self,
tx_hash: TxHash,
) -> Option<RecoveredTx<<Self::Transaction as PoolTransaction>::Pooled>>
fn get_pooled_transaction_element( &self, tx_hash: TxHash, ) -> 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn remove_transactions(
&self,
hashes: Vec<TxHash>,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn remove_transactions( &self, hashes: Vec<TxHash>, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Removes all transactions corresponding to the given hashes.
Consumer: Utility
Sourcefn remove_transactions_and_descendants(
&self,
hashes: Vec<TxHash>,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn remove_transactions_and_descendants( &self, hashes: Vec<TxHash>, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
Removes all transactions corresponding to the given hashes.
Also removes all dependent transactions.
Consumer: Utility
Sourcefn 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
Sourcefn 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
Sourcefn get(
&self,
tx_hash: &TxHash,
) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get( &self, tx_hash: &TxHash, ) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
Returns the transaction for the given hash.
Sourcefn get_all(
&self,
txs: Vec<TxHash>,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_all( &self, txs: Vec<TxHash>, ) -> 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.
Sourcefn on_propagated(&self, txs: PropagatedTransactions)
fn on_propagated(&self, txs: PropagatedTransactions)
Notify the pool about transactions that are propagated to peers.
Consumer: P2P
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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.
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn unique_senders(&self) -> HashSet<Address>
fn unique_senders(&self) -> HashSet<Address>
Returns a set of all senders of transactions in the pool
Sourcefn get_blob(
&self,
tx_hash: TxHash,
) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_blob( &self, tx_hash: TxHash, ) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError>
Returns the [BlobTransactionSidecar] for the given transaction hash if it exists in the blob store.
Sourcefn get_all_blobs(
&self,
tx_hashes: Vec<TxHash>,
) -> Result<Vec<(TxHash, Arc<BlobTransactionSidecar>)>, BlobStoreError>
fn get_all_blobs( &self, tx_hashes: Vec<TxHash>, ) -> Result<Vec<(TxHash, 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.
Sourcefn get_all_blobs_exact(
&self,
tx_hashes: Vec<TxHash>,
) -> Result<Vec<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_all_blobs_exact( &self, tx_hashes: Vec<TxHash>, ) -> 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.
Sourcefn get_blobs_for_versioned_hashes(
&self,
versioned_hashes: &[B256],
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>
fn get_blobs_for_versioned_hashes( &self, versioned_hashes: &[B256], ) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>
Return the [BlobTransactionSidecar
]s for a list of blob versioned hashes.
Provided Methods§
Sourcefn add_external_transaction(
&self,
transaction: Self::Transaction,
) -> impl Future<Output = PoolResult<TxHash>> + Send
fn add_external_transaction( &self, transaction: Self::Transaction, ) -> impl Future<Output = PoolResult<TxHash>> + 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
Sourcefn add_external_transactions(
&self,
transactions: Vec<Self::Transaction>,
) -> impl Future<Output = Vec<PoolResult<TxHash>>> + Send
fn add_external_transactions( &self, transactions: Vec<Self::Transaction>, ) -> impl Future<Output = Vec<PoolResult<TxHash>>> + Send
Imports all external transactions
Consumer: Utility
Sourcefn pending_transactions_listener(&self) -> Receiver<TxHash>
fn pending_transactions_listener(&self) -> Receiver<TxHash>
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
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn contains(&self, tx_hash: &TxHash) -> bool
fn contains(&self, tx_hash: &TxHash) -> bool
Returns if the transaction for the given hash is already included in this pool.
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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§
Source§impl<'a, T: 'a + TransactionPool + ?Sized> TransactionPool for &'a T
impl<'a, T: 'a + TransactionPool + ?Sized> 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: Self::Transaction, ) -> impl Future<Output = PoolResult<TxHash>> + Send
fn add_external_transactions( &self, transactions: Vec<Self::Transaction>, ) -> impl Future<Output = Vec<PoolResult<TxHash>>> + Send
fn add_transaction_and_subscribe( &self, origin: TransactionOrigin, transaction: Self::Transaction, ) -> impl Future<Output = PoolResult<TransactionEvents>> + Send
fn add_transaction( &self, origin: TransactionOrigin, transaction: Self::Transaction, ) -> impl Future<Output = PoolResult<TxHash>> + Send
fn add_transactions( &self, origin: TransactionOrigin, transactions: Vec<Self::Transaction>, ) -> impl Future<Output = Vec<PoolResult<TxHash>>> + Send
fn transaction_event_listener( &self, tx_hash: TxHash, ) -> Option<TransactionEvents>
fn all_transactions_event_listener( &self, ) -> AllTransactionsEvents<Self::Transaction>
fn pending_transactions_listener(&self) -> Receiver<TxHash>
fn pending_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> Receiver<TxHash>
fn new_transactions_listener( &self, ) -> Receiver<NewTransactionEvent<Self::Transaction>>
fn blob_transaction_sidecars_listener(&self) -> Receiver<NewBlobSidecar>
fn new_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> 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 pooled_transaction_hashes(&self) -> Vec<TxHash>
fn pooled_transaction_hashes_max(&self, max: usize) -> Vec<TxHash>
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<TxHash>, limit: GetPooledTransactionLimit, ) -> Vec<<Self::Transaction as PoolTransaction>::Pooled>
fn get_pooled_transaction_element( &self, tx_hash: TxHash, ) -> 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<TxHash>, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn remove_transactions_and_descendants( &self, hashes: Vec<TxHash>, ) -> 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 contains(&self, tx_hash: &TxHash) -> bool
fn get( &self, tx_hash: &TxHash, ) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_all( &self, txs: Vec<TxHash>, ) -> 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 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>>>
fn unique_senders(&self) -> HashSet<Address>
fn get_blob( &self, tx_hash: TxHash, ) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_all_blobs( &self, tx_hashes: Vec<TxHash>, ) -> Result<Vec<(TxHash, Arc<BlobTransactionSidecar>)>, BlobStoreError>
fn get_all_blobs_exact( &self, tx_hashes: Vec<TxHash>, ) -> Result<Vec<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_blobs_for_versioned_hashes( &self, versioned_hashes: &[B256], ) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>
Source§impl<T: TransactionPool + ?Sized> TransactionPool for Arc<T>
impl<T: TransactionPool + ?Sized> 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: Self::Transaction, ) -> impl Future<Output = PoolResult<TxHash>> + Send
fn add_external_transactions( &self, transactions: Vec<Self::Transaction>, ) -> impl Future<Output = Vec<PoolResult<TxHash>>> + Send
fn add_transaction_and_subscribe( &self, origin: TransactionOrigin, transaction: Self::Transaction, ) -> impl Future<Output = PoolResult<TransactionEvents>> + Send
fn add_transaction( &self, origin: TransactionOrigin, transaction: Self::Transaction, ) -> impl Future<Output = PoolResult<TxHash>> + Send
fn add_transactions( &self, origin: TransactionOrigin, transactions: Vec<Self::Transaction>, ) -> impl Future<Output = Vec<PoolResult<TxHash>>> + Send
fn transaction_event_listener( &self, tx_hash: TxHash, ) -> Option<TransactionEvents>
fn all_transactions_event_listener( &self, ) -> AllTransactionsEvents<Self::Transaction>
fn pending_transactions_listener(&self) -> Receiver<TxHash>
fn pending_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> Receiver<TxHash>
fn new_transactions_listener( &self, ) -> Receiver<NewTransactionEvent<Self::Transaction>>
fn blob_transaction_sidecars_listener(&self) -> Receiver<NewBlobSidecar>
fn new_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> 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 pooled_transaction_hashes(&self) -> Vec<TxHash>
fn pooled_transaction_hashes_max(&self, max: usize) -> Vec<TxHash>
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<TxHash>, limit: GetPooledTransactionLimit, ) -> Vec<<Self::Transaction as PoolTransaction>::Pooled>
fn get_pooled_transaction_element( &self, tx_hash: TxHash, ) -> 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<TxHash>, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
fn remove_transactions_and_descendants( &self, hashes: Vec<TxHash>, ) -> 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 contains(&self, tx_hash: &TxHash) -> bool
fn get( &self, tx_hash: &TxHash, ) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>
fn get_all( &self, txs: Vec<TxHash>, ) -> 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 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>>>
fn unique_senders(&self) -> HashSet<Address>
fn get_blob( &self, tx_hash: TxHash, ) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_all_blobs( &self, tx_hashes: Vec<TxHash>, ) -> Result<Vec<(TxHash, Arc<BlobTransactionSidecar>)>, BlobStoreError>
fn get_all_blobs_exact( &self, tx_hashes: Vec<TxHash>, ) -> Result<Vec<Arc<BlobTransactionSidecar>>, BlobStoreError>
fn get_blobs_for_versioned_hashes( &self, versioned_hashes: &[B256], ) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>
Implementors§
Source§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.