reth_transaction_pool

Trait BestTransactions

Source
pub trait BestTransactions: Iterator + Send {
    // Required methods
    fn mark_invalid(
        &mut self,
        transaction: &Self::Item,
        kind: InvalidPoolTransactionError,
    );
    fn no_updates(&mut self);
    fn set_skip_blobs(&mut self, skip_blobs: bool);

    // Provided methods
    fn without_updates(self) -> Self
       where Self: Sized { ... }
    fn skip_blobs(&mut self) { ... }
    fn without_blobs(self) -> Self
       where Self: Sized { ... }
    fn filter_transactions<P>(
        self,
        predicate: P,
    ) -> BestTransactionFilter<Self, P> 
       where P: FnMut(&Self::Item) -> bool,
             Self: Sized { ... }
}
Expand description

An Iterator that only returns transactions that are ready to be executed.

This makes no assumptions about the order of the transactions, but expects that all transactions are valid (no nonce gaps.) for the tracked state of the pool.

Note: this iterator will always return the best transaction that it currently knows. There is no guarantee transactions will be returned sequentially in decreasing priority order.

Required Methods§

Source

fn mark_invalid( &mut self, transaction: &Self::Item, kind: InvalidPoolTransactionError, )

Mark the transaction as invalid.

Implementers must ensure all subsequent transaction don’t depend on this transaction. In other words, this must remove the given transaction and drain all transaction that depend on it.

Source

fn no_updates(&mut self)

An iterator may be able to receive additional pending transactions that weren’t present it the pool when it was created.

This ensures that iterator will return the best transaction that it currently knows and not listen to pool updates.

Source

fn set_skip_blobs(&mut self, skip_blobs: bool)

Controls whether the iterator skips blob transactions or not.

If set to true, no blob transactions will be returned.

Provided Methods§

Source

fn without_updates(self) -> Self
where Self: Sized,

Convenience function for Self::no_updates that returns the iterator again.

Source

fn skip_blobs(&mut self)

Skip all blob transactions.

There’s only limited blob space available in a block, once exhausted, EIP-4844 transactions can no longer be included.

If called then the iterator will no longer yield blob transactions.

Note: this will also exclude any transactions that depend on blob transactions.

Source

fn without_blobs(self) -> Self
where Self: Sized,

Convenience function for Self::skip_blobs that returns the iterator again.

Source

fn filter_transactions<P>(self, predicate: P) -> BestTransactionFilter<Self, P>
where P: FnMut(&Self::Item) -> bool, Self: Sized,

Creates an iterator which uses a closure to determine whether a transaction should be returned by the iterator.

All items the closure returns false for are marked as invalid via Self::mark_invalid and descendant transactions will be skipped.

Implementations on Foreign Types§

Source§

impl<T> BestTransactions for Box<T>
where T: BestTransactions + ?Sized,

Source§

fn mark_invalid( &mut self, transaction: &Self::Item, kind: InvalidPoolTransactionError, )

Source§

fn no_updates(&mut self)

Source§

fn skip_blobs(&mut self)

Source§

fn set_skip_blobs(&mut self, skip_blobs: bool)

Source§

impl<T> BestTransactions for Empty<T>

A no-op implementation that yields no transactions.

Source§

fn mark_invalid(&mut self, _tx: &T, _kind: InvalidPoolTransactionError)

Source§

fn no_updates(&mut self)

Source§

fn skip_blobs(&mut self)

Source§

fn set_skip_blobs(&mut self, _skip_blobs: bool)

Implementors§