diff --git a/crates/transaction-pool/src/traits.rs b/crates/transaction-pool/src/traits.rs index fa5e22ec0aa3..e35912726133 100644 --- a/crates/transaction-pool/src/traits.rs +++ b/crates/transaction-pool/src/traits.rs @@ -747,6 +747,15 @@ pub trait BestTransactions: Iterator + Send { /// listen to pool updates. fn no_updates(&mut self); + /// Convenience function for [`Self::no_updates`] that returns the iterator again. + fn without_updates(mut self) -> Self + where + Self: Sized, + { + self.no_updates(); + self + } + /// Skip all blob transactions. /// /// There's only limited blob space available in a block, once exhausted, EIP-4844 transactions @@ -762,6 +771,15 @@ pub trait BestTransactions: Iterator + Send { /// If set to true, no blob transactions will be returned. fn set_skip_blobs(&mut self, skip_blobs: bool); + /// Convenience function for [`Self::skip_blobs`] that returns the iterator again. + fn without_blobs(mut self) -> Self + where + Self: Sized, + { + self.skip_blobs(); + self + } + /// Creates an iterator which uses a closure to determine whether a transaction should be /// returned by the iterator. /// diff --git a/crates/transaction-pool/tests/it/best.rs b/crates/transaction-pool/tests/it/best.rs index cd7a93eaedb9..20e833676436 100644 --- a/crates/transaction-pool/tests/it/best.rs +++ b/crates/transaction-pool/tests/it/best.rs @@ -5,6 +5,7 @@ use reth_transaction_pool::{noop::NoopTransactionPool, BestTransactions, Transac #[test] fn test_best_transactions() { let noop = NoopTransactionPool::default(); - let mut best = noop.best_transactions().filter_transactions(|_| true); + let mut best = + noop.best_transactions().filter_transactions(|_| true).without_blobs().without_updates(); assert!(best.next().is_none()); }