This allows full nodes to use bloom filters as an optimization when downloading blocks (dont double-relay txn) as long as we have a sufficiently large mempool.
Short-circuit bloom checking if we will always return true. #2338
pull TheBlueMatt wants to merge 1 commits into bitcoin:master from TheBlueMatt:bloom changing 1 files +4 −0-
TheBlueMatt commented at 1:39 AM on February 25, 2013: member
-
cbfc77352d
Short-circuit bloom checking if we will always return true.
This allows full nodes to use bloom filters as an optimization.
-
TheBlueMatt commented at 1:40 AM on February 25, 2013: member
I figure I get this simply included in the protocol so that we can later bother with the actual download optimizations.
-
BitcoinPullTester commented at 3:02 AM on February 25, 2013: none
Automatic sanity-testing: WARNING, see http://jenkins.bluematt.me/pull-tester/cbfc77352d095d562860fa8695ada5ac73cf7f67 for binaries and test log.
This pull decreases total test coverage, please add unit tests to test all new code and help us add test cases for existing code. Coverage report can be found at http://jenkins.bluematt.me/pull-tester/cbfc77352d095d562860fa8695ada5ac73cf7f67/bitcoin/src/total.coverage/
-
mikehearn commented at 10:34 AM on February 25, 2013: contributor
Hah, neat. Do the merkle blocks generated by such a filter have much overhead for the representation vs just a generic list of hashes?
-
sipa commented at 11:38 AM on February 25, 2013: member
@mikehearn 8 bytes + 0.25 byte/tx + overhead of sending the transactions in separate messages instead of inline in a block.
-
mikehearn commented at 3:07 PM on February 25, 2013: contributor
Actually 32.25 bytes per tx (we chatted about it offline)
-
TheBlueMatt commented at 6:47 PM on February 25, 2013: member
Yea, I think thats pretty good considering you have to atleast transfer the 32-byte sha256 hash of the tx (atleast given that you've already received most, if not all, of the txn in question).
-
gmaxwell commented at 6:55 PM on February 25, 2013: contributor
@TheBlueMatt not horrible, though a protocol made just for this could transmit— say— 8 bytes instead, and then just pull the whole block in the insanely rare case that there is a collision. Probably not worth doing inside the bitcoin p2p protocol however.
-
TheBlueMatt commented at 11:12 PM on February 25, 2013: member
Yea, absolutely could do better, but since this is already in the protocol, I figured I might as well enable it without wasting tons of CPU cycles hashing.
- gavinandresen referenced this in commit 65497f4ee7 on Feb 26, 2013
- gavinandresen merged this on Feb 26, 2013
- gavinandresen closed this on Feb 26, 2013
- laudney referenced this in commit 4f47e1afb9 on Mar 19, 2014
- DrahtBot locked this on Sep 8, 2021