Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use rolling bloom filter of recent block tx's for AlreadyHave() check
Summary: > In order to determine whether to download or process a relayed transaction, we > try to determine if we already have the transaction, either in the mempool, in > our recently rejected filter, in our orphan pool, or already confirmed in the > chain itself. > > Prior to this commit, the heuristic for checking the chain is based on whether > there's an output corresponding to the 0- or 1-index vout in our coin cache. > While that is a quick check, it is very imprecise (say if those outputs were > already spent in a block) -- we can do better by just keeping a rolling bloom > filter of the transactions in recent blocks, which will capture the case of a > transaction which has been confirmed and then fully spent already. > > To avoid relay problems for transactions which have been included in a recent > block but then reorged out of the chain, we clear the bloom filter whenever a > block is disconnected. This is a backport of [[bitcoin/bitcoin#17951 | PR17951]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, majcosta, deadalnix Reviewed By: #bitcoin_abc, majcosta, deadalnix Subscribers: deadalnix, majcosta Differential Revision: https://reviews.bitcoinabc.org/D8695
- Loading branch information
Showing
2 changed files
with
79 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters