aboutsummaryrefslogtreecommitdiff
path: root/depends
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2020-01-31 14:42:50 +0100
committerJonas Schnelli <dev@jonasschnelli.ch>2020-01-31 14:42:59 +0100
commitd104aa0ace36f5c2a125d8ae80f2e7e746f9eab8 (patch)
treecad87e1bd74a33cb37c95929178a5b83941c4847 /depends
parent3e1bf71064ccb98d0684753e844c80d6da421287 (diff)
parenta029e18c2bf67dd00552b0f4bbc85fa2fa5b973b (diff)
downloadbitcoin-d104aa0ace36f5c2a125d8ae80f2e7e746f9eab8.tar.xz
Merge #17951: Use rolling bloom filter of recent block txs for AlreadyHave() check
a029e18c2bf67dd00552b0f4bbc85fa2fa5b973b Use rolling bloom filter of recent block tx's for AlreadyHave() check (Suhas Daftuar) Pull request description: In order to determine whether to download or process a relayed transaction, we first try to check whether we already have the transaction -- either in the mempool, in our filter of recently rejected transactions, in our orphan pool, or already confirmed in a block. Prior to this commit, the heuristic for checking whether a transaction was confirmed in a block is based on whether there's a coin cache entry corresponding to the 0- or 1-index vout of the tx. While that is a quick check, it is very imprecise (eg if those outputs were already spent in another block, we wouldn't detect that the transaction has already been confirmed) -- we can do better by just keeping a rolling bloom filter of the transactions in recent blocks, which will better capture the case of a transaction which has been confirmed and then fully spent. This should reduce the bandwidth that we waste by requesting transactions which will not be accepted to the mempool. 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. ACKs for top commit: MarcoFalke: re-ACK a029e18c2b only stylistic and comment fixups 🍴 sipa: utACK a029e18c2bf67dd00552b0f4bbc85fa2fa5b973b jonatack: Code review ACK a029e18c2bf67dd00552b0f4bbc85fa2fa5b973b also built/ran tests and am running bitcoind with mempool debug logging and custom logging. Looked a bit into CRollingBloomFilter and also the mempool median time past checks mentioned above; I don't have a deep understanding of those areas yet but the concept here and changes LGTM. Tests and other optimisations could be added as a follow-up. In favor of seeing this move forward if no major immediate concerns. Tree-SHA512: 784c9a35bcd3af5db469063ac7d26b4bac430e451e5637a34d8a538c3ffd1433abdd3f06e5584e7a84bfa9e791449e61819397b5a6c7890fa59d78ec3ba507b2
Diffstat (limited to 'depends')
0 files changed, 0 insertions, 0 deletions