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

Open
wants to merge 4 commits into
base: main
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.

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

  • Adds a skips_verification_of_block_transactions_in_mempool test

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
Base automatically changed from verify-orphaned-mempool-txs to main November 18, 2024 12:16
@arya2 arya2 force-pushed the avoid-reverifying-mined-mempool-txs branch from c902901 to 1d63b0e Compare November 19, 2024 06:09
@mpguerra mpguerra removed the do-not-merge Tells Mergify not to merge this PR label Nov 21, 2024
@arya2 arya2 marked this pull request as ready for review November 21, 2024 23:55
@arya2 arya2 requested review from a team as code owners November 21, 2024 23:55
@arya2 arya2 requested review from oxarbitrage and removed request for a team November 21, 2024 23:55
@arya2 arya2 removed the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label Nov 22, 2024
@github-actions github-actions bot added the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label Nov 22, 2024
@arya2 arya2 force-pushed the avoid-reverifying-mined-mempool-txs branch from e1a3691 to e0861ec Compare November 22, 2024 19:53
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 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
2 participants