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.
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-
rebroad commented at 7:57 AM on May 22, 2012: contributor
-
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.
-
luke-jr commented at 2:48 AM on May 26, 2012: member
NACK, example of bad use of a global IMO
-
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)....
-
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.
-
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?
-
luke-jr commented at 2:43 PM on May 29, 2012: member
Too bad C++ doesn't have Perl's locals ;)
-
bbfad21c3d
Show peer that sent transaction when it causes a DoS(100).
Conflicts: src/main.cpp
-
jgarzik commented at 4:31 PM on August 1, 2012: contributor
Consensus: not worth it, closing
- jgarzik closed this on Aug 1, 2012
- suprnurd referenced this in commit 1c63052c3e on Dec 5, 2017
- lateminer referenced this in commit 0269732a28 on Jan 22, 2019
- lateminer referenced this in commit 41aae2d589 on May 6, 2020
- lateminer referenced this in commit ac4ab94dd8 on May 6, 2020
- DrahtBot locked this on Sep 8, 2021