Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Txpool functions to retrieve txs by state and origin #10294

Closed
mattsse opened this issue Aug 14, 2024 · 2 comments · Fixed by #10303
Closed

Add Txpool functions to retrieve txs by state and origin #10294

mattsse opened this issue Aug 14, 2024 · 2 comments · Fixed by #10303
Assignees
Labels
C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started

Comments

@mattsse
Copy link
Collaborator

mattsse commented Aug 14, 2024

Describe the feature

we have functions to retrieve txs by state:

fn pending_transactions(&self) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;

we also want convenience functions to get txs by origin TransactionOrigin

TODO

  • add convenience functions similar to
    /// Returns all transactions that where submitted as [TransactionOrigin::Local]
    fn get_local_transactions(&self) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
    self.get_transactions_by_origin(TransactionOrigin::Local)
    }

    but for pending or queued

Additional context

No response

@mattsse mattsse added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels Aug 14, 2024
@mattsse mattsse added D-good-first-issue Nice and easy! A great choice to get started and removed S-needs-triage This issue needs to be labelled labels Aug 14, 2024
@mvares
Copy link
Contributor

mvares commented Aug 14, 2024

@mattsse, I'm having one problem:

    pub(crate) fn get_pending_tx(
        &self,
        origin: TransactionOrigin,
    ) -> Vec<Arc<ValidPoolTransaction<<V as TransactionValidator>::Transaction>>> {
        self.pending_transactions().iter().filter(|tx| tx.origin == origin).collect()
    }

my IDE is hiting an error about the result type. I think is about collect()

@mattsse
Copy link
Collaborator Author

mattsse commented Aug 14, 2024

I think just Self::Transaction is sufficient

but this be implemented natively for perf reasons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants