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
  1. TheBlueMatt commented at 1:39 AM on February 25, 2013: member

    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.

  2. Short-circuit bloom checking if we will always return true.
    This allows full nodes to use bloom filters as an optimization.
    cbfc77352d
  3. 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.

  4. 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/

  5. 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?

  6. 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.

  7. mikehearn commented at 3:07 PM on February 25, 2013: contributor

    Actually 32.25 bytes per tx (we chatted about it offline)

  8. 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).

  9. 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.

  10. 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.

  11. gavinandresen referenced this in commit 65497f4ee7 on Feb 26, 2013
  12. gavinandresen merged this on Feb 26, 2013
  13. gavinandresen closed this on Feb 26, 2013

  14. laudney referenced this in commit 4f47e1afb9 on Mar 19, 2014
  15. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-24 15:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me