From baa03294cfcbfc869324ba5bc34747ddcc3e36a8 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 6 Aug 2025 20:18:05 +0200 Subject: [PATCH] fix: enforce propagate on getpooledtx (#17720) Co-authored-by: Bharath Vedartham --- crates/transaction-pool/src/pool/mod.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/transaction-pool/src/pool/mod.rs b/crates/transaction-pool/src/pool/mod.rs index c8f8d251f3..cf330853c8 100644 --- a/crates/transaction-pool/src/pool/mod.rs +++ b/crates/transaction-pool/src/pool/mod.rs @@ -341,7 +341,8 @@ where } } - /// Returns pooled transactions for the given transaction hashes. + /// Returns pooled transactions for the given transaction hashes that are allowed to be + /// propagated. pub fn get_pooled_transaction_elements( &self, tx_hashes: Vec, @@ -350,7 +351,7 @@ where where ::Transaction: EthPoolTransaction, { - let transactions = self.get_all(tx_hashes); + let transactions = self.get_all_propagatable(tx_hashes); let mut elements = Vec::with_capacity(transactions.len()); let mut size = 0; for transaction in transactions { @@ -953,6 +954,19 @@ where self.get_pool_data().get_all(txs).collect() } + /// Returns all the transactions belonging to the hashes that are propagatable. + /// + /// If no transaction exists, it is skipped. + fn get_all_propagatable( + &self, + txs: Vec, + ) -> Vec>> { + if txs.is_empty() { + return Vec::new() + } + self.get_pool_data().get_all(txs).filter(|tx| tx.propagate).collect() + } + /// Notify about propagated transactions. pub fn on_propagated(&self, txs: PropagatedTransactions) { if txs.0.is_empty() {