Skip to content

Skip download and verification if the transaction is already in the mempool or state#2718

Merged
dconnolly merged 13 commits into
mainfrom
check-existing-txs
Sep 8, 2021
Merged

Skip download and verification if the transaction is already in the mempool or state#2718
dconnolly merged 13 commits into
mainfrom
check-existing-txs

Conversation

@conradoplg
Copy link
Copy Markdown
Collaborator

@conradoplg conradoplg commented Aug 31, 2021

Motivation

We should only download/verify a transaction if it's not already in the mempool or state.

Specifications

Designs

Solution

Pass a mempool reference to the downloader. Query mempool and state to skip download if applicable.

This adds a new request to the mempool to check if a tx was rejected.

Closes #2708

Review

Since this modifies the mempool instantiation and adds a new request, it would be good to review soon to avoid conflicts.

Reviewer Checklist

  • Code implements Specs and Designs
  • Tests for Expected Behaviour
  • Tests for Errors

Follow Up Work

Handling pushed transactions in #2727

@ghost ghost assigned conradoplg Aug 31, 2021
Comment thread zebrad/src/components/mempool/downloads.rs Outdated
Comment thread zebrad/src/components/mempool.rs Outdated
Base automatically changed from transaction-sync-verifier to main September 2, 2021 00:06
@conradoplg conradoplg marked this pull request as ready for review September 2, 2021 14:59
@conradoplg conradoplg mentioned this pull request Sep 2, 2021
3 tasks
@mpguerra mpguerra requested a review from dconnolly September 7, 2021 08:59
Copy link
Copy Markdown
Contributor

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

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

I think it will be good to make the tests, the rest looks all good to me.

Comment thread zebrad/src/commands/start.rs
Comment thread zebrad/src/commands/start.rs Outdated
Comment thread zebrad/src/components/inbound.rs Outdated
Comment thread zebrad/src/components/inbound/tests.rs Outdated
Comment thread zebrad/src/components/mempool.rs
Comment thread zebrad/src/components/mempool/storage.rs
Copy link
Copy Markdown
Collaborator Author

@conradoplg conradoplg left a comment

Choose a reason for hiding this comment

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

Addressed some comments, I won't touch the tests for now since @oxarbitrage offered to help with them as discussed in Discord (thanks!)

Comment thread zebrad/src/commands/start.rs
Comment thread zebrad/src/commands/start.rs Outdated
Comment thread zebrad/src/components/inbound.rs Outdated
Comment thread zebrad/src/components/inbound/tests.rs Outdated
Copy link
Copy Markdown
Contributor

@dconnolly dconnolly left a comment

Choose a reason for hiding this comment

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

I have left a comment that's non-blocking but just wanted to double-check, otherwise looks great!

Comment thread zebrad/src/components/mempool/downloads.rs
@dconnolly dconnolly enabled auto-merge (rebase) September 8, 2021 18:19
@dconnolly dconnolly disabled auto-merge September 8, 2021 18:19
@dconnolly dconnolly enabled auto-merge (squash) September 8, 2021 18:19
@dconnolly dconnolly merged commit a2993e8 into main Sep 8, 2021
@dconnolly dconnolly deleted the check-existing-txs branch September 8, 2021 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip download and verification if the transaction is already in the mempool or state

4 participants