fix: enforce propagate on getpooledtx (#17720)

Co-authored-by: Bharath Vedartham <vedabharath12345@gmail.com>
This commit is contained in:
Matthias Seitz
2025-08-06 20:18:05 +02:00
committed by GitHub
parent f5c2502f55
commit baa03294cf

View File

@@ -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<TxHash>,
@@ -350,7 +351,7 @@ where
where
<V as TransactionValidator>::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<TxHash>,
) -> Vec<Arc<ValidPoolTransaction<T::Transaction>>> {
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() {