Trait BestTransactions
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§
fn mark_invalid(
&mut self,
transaction: &Self::Item,
kind: InvalidPoolTransactionError,
)
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.
fn no_updates(&mut self)
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.
fn set_skip_blobs(&mut self, skip_blobs: bool)
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§
fn without_updates(self) -> Selfwhere
Self: Sized,
fn without_updates(self) -> Selfwhere
Self: Sized,
Convenience function for Self::no_updates
that returns the iterator again.
fn skip_blobs(&mut self)
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.
fn without_blobs(self) -> Selfwhere
Self: Sized,
fn without_blobs(self) -> Selfwhere
Self: Sized,
Convenience function for Self::skip_blobs
that returns the iterator again.
fn filter_transactions<P>(self, predicate: P) -> BestTransactionFilter<Self, P> ⓘ
fn filter_transactions<P>(self, predicate: P) -> BestTransactionFilter<Self, P> ⓘ
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§
§impl<T> BestTransactions for Box<T>where
T: BestTransactions + ?Sized,
impl<T> BestTransactions for Box<T>where
T: BestTransactions + ?Sized,
fn mark_invalid( &mut self, transaction: &<Box<T> as Iterator>::Item, kind: InvalidPoolTransactionError, )
fn no_updates(&mut self)
fn skip_blobs(&mut self)
fn set_skip_blobs(&mut self, skip_blobs: bool)
§impl<T> BestTransactions for Empty<T>
A no-op implementation that yields no transactions.
impl<T> BestTransactions for Empty<T>
A no-op implementation that yields no transactions.