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

change(rpc): Avoid re-verifying transactions in blocks if those transactions are in the mempool #8951

Draft
wants to merge 4 commits into
base: verify-orphaned-mempool-txs
Choose a base branch
from

Conversation

arya2
Copy link
Contributor

@arya2 arya2 commented Oct 19, 2024

Motivation

We want the transaction verifier to avoid re-verifying transactions for the block verifier that have already been verified for the mempool.

This is a draft PR as it still needs tests.

Depends-On: #8857.
Closes #5674.

Solution

  • Adds transaction_hash and known_outpoint_hashes fields on transaction::Request::Block.
  • Adds a mempool request for querying a transaction and its dependencies by its mined id
  • Adds and calls a try_find_verified_unmined_tx() method on the transaction verifier which queries the mempool for the transaction, then checks that all of its dependencies are present in the set of known_outpoint_hashes.

Tests

This PR still needs tests.

PR Author's Checklist

  • The PR name will make sense to users.
  • The PR provides a CHANGELOG summary.
  • The solution is tested.
  • The documentation is up to date.
  • The PR has a priority label.

PR Reviewer's Checklist

  • The PR Author's checklist is complete.
  • The PR resolves the issue.

@arya2 arya2 self-assigned this Oct 19, 2024
@github-actions github-actions bot added the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label Oct 19, 2024
@arya2 arya2 added I-slow Problems with performance or responsiveness A-rpc Area: Remote Procedure Call interfaces P-Low ❄️ and removed C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG labels Oct 19, 2024
@arya2 arya2 force-pushed the avoid-reverifying-mined-mempool-txs branch from 3633bb6 to 837c077 Compare October 19, 2024 05:10
@github-actions github-actions bot added C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG labels Oct 19, 2024
@arya2 arya2 changed the title change(rpc): Avoid re-verifying transactions for the block verifier that are present in the mempool change(rpc): Avoid re-verifying transactions in blocks that are present in the mempool Oct 19, 2024
@arya2 arya2 changed the title change(rpc): Avoid re-verifying transactions in blocks that are present in the mempool change(rpc): Avoid re-verifying transactions in blocks if those transactions that are present in the mempool Oct 19, 2024
@arya2 arya2 changed the title change(rpc): Avoid re-verifying transactions in blocks if those transactions that are present in the mempool change(rpc): Avoid re-verifying transactions in blocks if those transactions are in the mempool Oct 19, 2024
@arya2 arya2 added the do-not-merge Tells Mergify not to merge this PR label Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Area: Remote Procedure Call interfaces C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG do-not-merge Tells Mergify not to merge this PR I-slow Problems with performance or responsiveness P-Low ❄️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically verify transactions in blocks when the same transaction is already in the mempool
1 participant