perf: inline pooled transactions max (#12805)

This commit is contained in:
Matthias Seitz
2024-11-23 08:08:41 +01:00
committed by GitHub
parent 13786c76d4
commit 0d17f14e3d
2 changed files with 9 additions and 1 deletions

View File

@@ -409,7 +409,7 @@ where
&self,
max: usize,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
self.pooled_transactions().into_iter().take(max).collect()
self.pool.pooled_transactions_max(max)
}
fn get_pooled_transaction_elements(

View File

@@ -304,6 +304,14 @@ where
self.get_pool_data().all().transactions_iter().filter(|tx| tx.propagate).collect()
}
/// Returns only the first `max` transactions in the pool.
pub(crate) fn pooled_transactions_max(
&self,
max: usize,
) -> Vec<Arc<ValidPoolTransaction<T::Transaction>>> {
self.get_pool_data().all().transactions_iter().filter(|tx| tx.propagate).take(max).collect()
}
/// Returns the [`BlobTransaction`] for the given transaction if the sidecar exists.
///
/// Caution: this assumes the given transaction is eip-4844