diff --git a/crates/transaction-pool/src/traits.rs b/crates/transaction-pool/src/traits.rs
index eb9d35ad5..fa5e22ec0 100644
--- a/crates/transaction-pool/src/traits.rs
+++ b/crates/transaction-pool/src/traits.rs
@@ -761,6 +761,19 @@ pub trait BestTransactions: Iterator + Send {
///
/// If set to true, no blob transactions will be returned.
fn set_skip_blobs(&mut self, skip_blobs: bool);
+
+ /// 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.
+ fn filter_transactions
(self, predicate: P) -> BestTransactionFilter
+ where
+ P: FnMut(&Self::Item) -> bool,
+ Self: Sized,
+ {
+ BestTransactionFilter::new(self, predicate)
+ }
}
impl BestTransactions for Box
diff --git a/crates/transaction-pool/tests/it/best.rs b/crates/transaction-pool/tests/it/best.rs
new file mode 100644
index 000000000..cd7a93eae
--- /dev/null
+++ b/crates/transaction-pool/tests/it/best.rs
@@ -0,0 +1,10 @@
+//! Best transaction and filter testing
+
+use reth_transaction_pool::{noop::NoopTransactionPool, BestTransactions, TransactionPool};
+
+#[test]
+fn test_best_transactions() {
+ let noop = NoopTransactionPool::default();
+ let mut best = noop.best_transactions().filter_transactions(|_| true);
+ assert!(best.next().is_none());
+}
diff --git a/crates/transaction-pool/tests/it/main.rs b/crates/transaction-pool/tests/it/main.rs
index ead33a328..7db2b14c9 100644
--- a/crates/transaction-pool/tests/it/main.rs
+++ b/crates/transaction-pool/tests/it/main.rs
@@ -9,4 +9,6 @@ mod listeners;
#[cfg(feature = "test-utils")]
mod pending;
+mod best;
+
const fn main() {}