Recent rejects backport to v0.11 #6750

pull petertodd wants to merge 6 commits into bitcoin:0.11 from petertodd:recent-rejects-v0.11-backport changing 5 files +109 −23
  1. petertodd commented at 10:33 AM on October 2, 2015: contributor

    Backport of #6498 to v0.11.x

    Rational: You can waste a lot of bandwidth w/o this patch, e.g. if min relay fee is set higher than normal to avoid a flood attack from crashing your node due to OOM; this is a fairly important anti-DoS protection.

    The patch set was cherry-picked perfectly w/ no merge issues as the relevant code hasn't changed from v0.11 to v0.12

  2. Add uint256 support to CRollingBloomFilter
    (cherry picked from commit bbe41088c61f2ad328766e851ffe6169aa80935a)
    2983fe0484
  3. Reuse vector hashing code for uint256
    (cherry picked from commit a3d65fedaa18686f0cc007d0a13dba6545250300)
    25cf1220e6
  4. Make CRollingBloomFilter set nTweak for you
    While CBloomFilter is usually used with an explicitly set nTweak,
    CRollingBloomFilter is only used internally. Requiring every caller to
    set nTweak is error-prone and redundant; better to have the class handle
    that for you with a high-quality randomness source.
    
    Additionally when clearing the filter it makes sense to change nTweak as
    well to recover from a bad setting, e.g. due to insufficient randomness
    at initialization, so the clear() method is replaced by a reset() method
    that sets a new, random, nTweak value.
    
    (cherry picked from commit d2d7ee0e863b286e1c9f9c54659d494fb0a7712d)
    83671efe99
  5. Only use randomly created nonces in CRollingBloomFilter.
    (cherry picked from commit d741371d7d27e228aa64c618c50b23fb5449c3e1)
    6eed52e05b
  6. Keep track of recently rejected transactions
    Nodes can have divergent policies on which transactions they will accept
    and relay.  This can cause you to repeatedly request and reject the same
    tx after its inved to you from various peers which have accepted it.
    Here we add rolling bloom filter to keep track of such rejections,
    clearing the filter every time the chain tip changes.
    
    Credit goes to Alex Morcos, who created the patch that this code is
    based on.
    
    Original code by Peter Todd. Refactored to not construct the
    filter at startup time by Pieter Wuille.
    
    (cherry picked from commit 0847d9cb5fcd2fdd5a21bde699944d966cf5add9)
    ec9b6c33e8
  7. Move recentRejects initialization to top of InitBlockIndex
    This avoids that premature return in the condition that a new chain is initialized
    results in NULL pointer errors due to recentReject not being constructed.
    
    Also add assertions where it is used.
    
    (cherry picked from commit a8d0407c4fcf7c4e8ed0e8edabd204f7a4efa477)
    5094a81d3b
  8. btcdrak commented at 1:14 PM on October 2, 2015: contributor

    utACK, verified each commit as a cherry pick.

  9. dcousens commented at 11:32 PM on October 4, 2015: contributor

    utACK

  10. laanwj added the label Validation on Oct 5, 2015
  11. laanwj added the label P2P on Oct 5, 2015
  12. laanwj commented at 2:18 PM on October 6, 2015: member

    Code review ACK

  13. laanwj merged this on Oct 6, 2015
  14. laanwj closed this on Oct 6, 2015

  15. laanwj referenced this in commit 5ed8d0b37e on Oct 6, 2015
  16. dgenr8 commented at 2:31 PM on October 6, 2015: contributor

    #6588 plugs a hole in this, should maybe be backported too.

  17. petertodd commented at 5:03 PM on October 6, 2015: contributor

    @dgenr8 Seems reasonable to me; you should open a pull-req.

  18. MarcoFalke 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-13 18:15 UTC

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