In (strCommand == "tx"), return if AlreadyHave() #6588

pull dgenr8 wants to merge 1 commits into bitcoin:master from dgenr8:already_have changing 1 files +7 −7
  1. dgenr8 commented at 1:51 AM on August 25, 2015: contributor

    A live DoS attack observed by several nodes in recent days involved repeated rejection of duplicate transactions.

    Add a call to AlreadyHave when an unsolicited full tx is received, as was the case in the observed attack. AlreadyHave uses the recentRejects filter.

    I tested this change on mainnet while the actual attack was still underway.

    The recentRejects filter is cleared when the tip is updated, so nothing stops attacker from re-transmitting a load of rejectable txes after a new block, and in fact our attacker was doing this. But the duplicates are stopped between blocks and the attack could get arbitrarily heavy if multiple attacking peers were involved.

  2. dgenr8 cross-referenced this on Aug 25, 2015 from issue Track recently rejected transactions; don't reprocess by dgenr8
  3. sipa commented at 9:39 PM on August 25, 2015: member

    Concept ACK

  4. dajohi commented at 2:03 PM on August 26, 2015: contributor

    What are you thoughts on disallowing unsolicited tx's -- peers that send a tx without a getdata request. That would break bitcoinj though.

  5. gavinandresen commented at 2:43 PM on August 27, 2015: contributor

    Untested ACK.

  6. in src/main.cpp:None in 4d2117a13c outdated
    4332 | -            // means it was rejected and we shouldn't ask for it again.
    4333 | -            if (!mempool.exists(tx.GetHash())) {
    4334 | -                assert(recentRejects);
    4335 | -                recentRejects->insert(tx.GetHash());
    4336 | -            }
    4337 | +        } else
    


    laanwj commented at 3:26 PM on September 3, 2015:

    Nit: can you please keep the style the same here

  7. laanwj commented at 3:27 PM on September 3, 2015: member

    utACK, nice catch

  8. laanwj added the label P2P on Sep 3, 2015
  9. In (strCommand == "tx"), return if AlreadyHave()
    The main effect is to exit processing for recently-rejected hashes,
    in case they are pushed to us without prior advertisement.  This
    behavior was seen in the wild.
    
    An additional effect is to do early checks for mempool or mapOrphan
    existence.  No logging or nDoS tracking is needed for failures of
    these checks.
    9524c4d35c
  10. dgenr8 force-pushed on Sep 3, 2015
  11. dgenr8 commented at 5:28 PM on September 3, 2015: contributor

    @laanwj done

  12. btcdrak commented at 11:37 PM on September 7, 2015: contributor

    utACK

  13. dcousens commented at 1:06 AM on September 8, 2015: contributor

    utACK

  14. jgarzik commented at 9:59 AM on October 1, 2015: contributor

    tested ACK

  15. jgarzik merged this on Oct 1, 2015
  16. jgarzik closed this on Oct 1, 2015

  17. jgarzik referenced this in commit cf9bb11f97 on Oct 1, 2015
  18. dgenr8 cross-referenced this on Oct 6, 2015 from issue Recent rejects backport to v0.11 by petertodd
  19. dgenr8 cross-referenced this on Oct 9, 2015 from issue Backport to v0.11: In (strCommand == "tx"), return if AlreadyHave() by dgenr8
  20. dgenr8 deleted the branch on Sep 19, 2018
  21. bitcoin 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-05-20 06:55 UTC