Skip to content

Conversation

@AnInsaneJimJam
Copy link

Summary

Adds filter_pooled_txs method to efficiently filter pooled transactions using a predicate, avoiding the need to collect all transactions before filtering.

Changes

  • Added TransactionPoolExtExt trait with filter_pooled_txsmethod
  • Implemented efficient filtering in Pool that applies predicate during iteration
  • Updated maintain_transaction_pool_conditional
    to use the new method

This closes #19919

@figtracer
Copy link
Contributor

does it make sense to add an append_* helper for this function as well, following #20028? @mattsse

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the function lgtm, but we should move this into the existing TransactionPoolExt so that this can be specialized by implementers

Comment on lines +700 to +705
fn filter_pooled_txs<F>(
&self,
mut predicate: F,
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>
where
F: FnMut(&Arc<ValidPoolTransaction<Self::Transaction>>) -> bool,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this to the existing trait instead, so that this can be specialized, because this is effectively how it was before

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Add TransactionPoolExt::filter_pooled_txs(Fn(&) -> bool)

3 participants