Type Alias TestPool

Source
pub type TestPool = Pool<MockTransactionValidator<MockTransaction>, MockOrdering, InMemoryBlobStore>;
Available on crate feature test-utils only.
Expand description

A Pool used for testing

Aliased Type§

struct TestPool { /* private fields */ }

Implementations

Source§

impl<V, T, S> Pool<V, T, S>

Source

pub fn new(validator: V, ordering: T, blob_store: S, config: PoolConfig) -> Self

Create a new transaction pool instance.

Source

pub fn config(&self) -> &PoolConfig

Get the config the pool was configured with.

Source

pub fn len(&self) -> usize

Number of transactions in the entire pool

Source

pub fn is_empty(&self) -> bool

Whether the pool is empty

Source

pub fn is_exceeded(&self) -> bool

Returns whether or not the pool is over its configured size and transaction count limits.

Source

pub fn blob_store(&self) -> &S

Returns the configured blob store.

Trait Implementations§

Source§

impl From<TestPoolBuilder> for TestPool

Source§

fn from(wrapper: TestPoolBuilder) -> Self

Converts to this type from the input type.
Source§

impl<V, T: TransactionOrdering, S> Clone for Pool<V, T, S>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: Debug, T: Debug + TransactionOrdering, S: Debug> Debug for Pool<V, T, S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V, T, S> TransactionPool for Pool<V, T, S>

implements the TransactionPool interface for various transaction pool API consumers.

Source§

fn get_pending_transactions_by_origin( &self, origin: TransactionOrigin, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all pending transactions filtered by TransactionOrigin

Source§

type Transaction = <T as TransactionOrdering>::Transaction

The transaction type of the pool
Source§

fn pool_size(&self) -> PoolSize

Returns stats about the pool and all sub-pools.
Source§

fn block_info(&self) -> BlockInfo

Returns the block the pool is currently tracking. Read more
Source§

async fn add_transaction_and_subscribe( &self, origin: TransactionOrigin, transaction: Self::Transaction, ) -> PoolResult<TransactionEvents>

Adds an unvalidated transaction into the pool and subscribe to state changes. Read more
Source§

async fn add_transaction( &self, origin: TransactionOrigin, transaction: Self::Transaction, ) -> PoolResult<TxHash>

Adds an unvalidated transaction into the pool. Read more
Source§

async fn add_transactions( &self, origin: TransactionOrigin, transactions: Vec<Self::Transaction>, ) -> Vec<PoolResult<TxHash>>

Adds the given unvalidated transaction into the pool. Read more
Source§

fn transaction_event_listener( &self, tx_hash: TxHash, ) -> Option<TransactionEvents>

Returns a new transaction change event stream for the given transaction. Read more
Source§

fn all_transactions_event_listener( &self, ) -> AllTransactionsEvents<Self::Transaction>

Returns a new transaction change event stream for all transactions in the pool.
Source§

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.
Source§

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
Source§

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.
Source§

fn pooled_transaction_hashes(&self) -> Vec<TxHash>

Returns the hashes of all transactions in the pool. Read more
Source§

fn pooled_transaction_hashes_max(&self, max: usize) -> Vec<TxHash>

Returns only the first max hashes of transactions in the pool. Read more
Source§

fn pooled_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns the full transaction objects all transactions in the pool. Read more
Source§

fn pooled_transactions_max( &self, max: usize, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns only the first max transactions in the pool. Read more
Source§

fn get_pooled_transaction_elements( &self, tx_hashes: Vec<TxHash>, limit: GetPooledTransactionLimit, ) -> Vec<<<V as TransactionValidator>::Transaction as PoolTransaction>::Pooled>

Returns converted [PooledTransaction] for the given transaction hashes. Read more
Source§

fn get_pooled_transaction_element( &self, tx_hash: TxHash, ) -> Option<Recovered<<<V as TransactionValidator>::Transaction as PoolTransaction>::Pooled>>

Returns the pooled transaction variant for the given transaction hash. Read more
Source§

fn best_transactions( &self, ) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>>

Returns an iterator that yields transactions that are ready for block production. Read more
Source§

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. Read more
Source§

fn pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all transactions that can be included in the next block. Read more
Source§

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 Read more
Source§

fn queued_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all transactions that can be included in future blocks. Read more
Source§

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. Read more
Source§

fn remove_transactions( &self, hashes: Vec<TxHash>, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Removes all transactions corresponding to the given hashes. Read more
Source§

fn remove_transactions_and_descendants( &self, hashes: Vec<TxHash>, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Removes all transactions corresponding to the given hashes. Read more
Source§

fn remove_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Removes all transactions from the given sender Read more
Source§

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. Read more
Source§

fn get( &self, tx_hash: &TxHash, ) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns the transaction for the given hash.
Source§

fn get_all( &self, txs: Vec<TxHash>, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all transactions objects for the given hashes. Read more
Source§

fn on_propagated(&self, txs: PropagatedTransactions)

Notify the pool about transactions that are propagated to peers. Read more
Source§

fn get_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all transactions sent by a given user
Source§

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
Source§

fn get_pending_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all pending transactions sent by a given user
Source§

fn get_queued_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all queued transactions sent by a given user
Source§

fn get_highest_transaction_by_sender( &self, sender: Address, ) -> Option<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns the highest transaction sent by a given user
Source§

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. Read more
Source§

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
Source§

fn get_transactions_by_origin( &self, origin: TransactionOrigin, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all transactions that where submitted with the given TransactionOrigin
Source§

fn unique_senders(&self) -> HashSet<Address>

Returns a set of all senders of transactions in the pool
Source§

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.
Source§

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. Read more
Source§

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. Read more
Source§

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.
Source§

fn add_external_transaction( &self, transaction: Self::Transaction, ) -> impl Future<Output = PoolResult<TxHash>> + Send

Imports an external transaction. Read more
Source§

fn add_external_transactions( &self, transactions: Vec<Self::Transaction>, ) -> impl Future<Output = Vec<PoolResult<TxHash>>> + Send

Imports all external transactions Read more
Source§

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. Read more
Source§

fn new_transactions_listener( &self, ) -> Receiver<NewTransactionEvent<Self::Transaction>>

Returns a new stream that yields new valid transactions added to the pool.
Source§

fn new_pending_pool_transactions_listener( &self, ) -> NewSubpoolTransactionStream<Self::Transaction>

Returns a new Stream that yields new transactions added to the pending sub-pool. Read more
Source§

fn new_basefee_pool_transactions_listener( &self, ) -> NewSubpoolTransactionStream<Self::Transaction>

Returns a new Stream that yields new transactions added to the basefee sub-pool. Read more
Source§

fn new_queued_transactions_listener( &self, ) -> NewSubpoolTransactionStream<Self::Transaction>

Returns a new Stream that yields new transactions added to the queued-pool. Read more
Source§

fn contains(&self, tx_hash: &TxHash) -> bool

Returns if the transaction for the given hash is already included in this pool.
Source§

fn get_local_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all transactions that where submitted as TransactionOrigin::Local
Source§

fn get_private_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all transactions that where submitted as TransactionOrigin::Private
Source§

fn get_external_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all transactions that where submitted as TransactionOrigin::External
Source§

fn get_local_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all pending transactions that where submitted as TransactionOrigin::Local
Source§

fn get_private_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all pending transactions that where submitted as TransactionOrigin::Private
Source§

fn get_external_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all pending transactions that where submitted as TransactionOrigin::External
Source§

impl<V, T, S> TransactionPoolExt for Pool<V, T, S>

Source§

fn set_block_info(&self, info: BlockInfo)

Sets the current block info for the pool.
Source§

fn on_canonical_state_change<B>(&self, update: CanonicalStateUpdate<'_, B>)
where B: Block,

Event listener for when the pool needs to be updated. Read more
Source§

fn update_accounts(&self, accounts: Vec<ChangedAccount>)

Updates the accounts in the pool
Source§

fn delete_blob(&self, tx: TxHash)

Deletes the blob sidecar for the given transaction from the blob store
Source§

fn delete_blobs(&self, txs: Vec<TxHash>)

Deletes multiple blob sidecars from the blob store
Source§

fn cleanup_blobs(&self)

Maintenance function to cleanup blobs that are no longer needed.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 8 bytes