Show peer that sent transaction when it causes a DoS(100). #1375

pull rebroad wants to merge 1 commits into bitcoin:master from rebroad:LogDoS100TxPeer changing 1 files +70 −22
  1. rebroad commented at 7:57 AM on May 22, 2012: contributor

    I originally raised pull #1311 with this, but that was too big and contained too many changes. Pull #1338 followed, but still had some changes which were contentious. This pull contains just the addition of displaying the peer of DoS(100) transactions, and pull #1338 has had that part removed.

  2. gavinandresen commented at 4:06 PM on May 25, 2012: contributor

    Is this thread safe? What if the thread executing the if (txnode) is interrupted after the if test, could another thread wake up and set txnode=NULL ?

    NACK in general-- too many code changes, the risks outweigh the (minimal) benefits.

  3. luke-jr commented at 2:48 AM on May 26, 2012: member

    NACK, example of bad use of a global IMO

  4. rebroad commented at 8:47 AM on May 29, 2012: contributor

    @gavinandresen It's thread safe unless some future change tries to change the value of txnode from a different thread. So far, only one thread uses txnode, so the value won't get changed between the test and the use. @luke-jr - thanks for the feedback. How would you recommend doing it? I realise I could just add one line in ProcessMessage() to log the peer against the tx, but I guess my motivation was to keep debug.log small (at the expense of code brevity)....

  5. sipa commented at 10:13 AM on May 29, 2012: member

    You're right that currently txnode is only set in ProcessMessage, which is only used in a single thread. But I agree it's a bad use of a global. If you really need to know who sent it, pass it along in arguments, or only report the offender from functions that do know.

    Not worth it, imho.

  6. rebroad commented at 2:38 PM on May 29, 2012: contributor

    @sipa I did try passing it in arguments, but I was getting errors about incorrect number of arguments. Perhaps my understanding of C++ isn't quite sufficient.. :-s Is there any way to restrict the use of txnode so that it can't be used by other threads?

  7. luke-jr commented at 2:43 PM on May 29, 2012: member

    Too bad C++ doesn't have Perl's locals ;)

  8. Show peer that sent transaction when it causes a DoS(100).
    Conflicts:
    
    	src/main.cpp
    bbfad21c3d
  9. jgarzik commented at 4:31 PM on August 1, 2012: contributor

    Consensus: not worth it, closing

  10. jgarzik closed this on Aug 1, 2012

  11. suprnurd referenced this in commit 1c63052c3e on Dec 5, 2017
  12. lateminer referenced this in commit 0269732a28 on Jan 22, 2019
  13. lateminer referenced this in commit 41aae2d589 on May 6, 2020
  14. lateminer referenced this in commit ac4ab94dd8 on May 6, 2020
  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-22 18:16 UTC

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