- prevents unneeded log messages, which could make users think something bad was happening
special case DoS value == 0 #3047
pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:misbehave changing 1 files +4 −4-
Diapolo commented at 2:30 PM on October 1, 2013: none
-
gavinandresen commented at 4:32 AM on October 4, 2013: contributor
NACK on the else if (howmuch == 0). That is dead code, because the only two places Misbehaving(0) can happen are the two places where you put checks to not call Misbehaving in the first place.
Either keep the checks, or just have Misbehaving(0) simply do if howmuch == 0 return;
-
fbed9c9d63
special case DoS value == 0 in ProcessMessage()
- prevents unneeded log messages, which could make users think something bad was happening
-
Diapolo commented at 8:13 AM on October 4, 2013: none
@gavinandresen Updated and removed the
else if (howmuch == 0). Should be fine now. -
sipa commented at 8:35 AM on October 4, 2013: member
ACK
-
BitcoinPullTester commented at 10:03 AM on October 4, 2013: none
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/fbed9c9d6356f86e5507b3fc032f263a17137d57 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
-
laanwj commented at 10:07 AM on October 4, 2013: member
ACK
Though I must say the code is a bit confusing to read. The argument of state.IsInvalid(nDoS) is an inout argument which is then checked in the same if() clause.
- gavinandresen referenced this in commit 15b48ab036 on Oct 4, 2013
- gavinandresen merged this on Oct 4, 2013
- gavinandresen closed this on Oct 4, 2013
-
Diapolo commented at 12:08 PM on October 6, 2013: none
You were thinking of this?
<pre> int nDoS = 0; if (state.IsInvalid(nDoS)) if (nDoS > 0) pfrom->Misbehaving(nDoS); </pre>
Yeah would be easier to read...
-
laanwj commented at 6:38 AM on October 7, 2013: member
@Diapolo Yes, I'd prefer something like that, as it gives more of a signal to the reader that nDOS is the result of the state.IsInvalid() call. Now they could think 'hey, it's never >0, let's cut that code out!', but never mind this is just bikeshedding...
- Bushstar referenced this in commit 4a7525da38 on Apr 8, 2020
- Bushstar referenced this in commit 2e0cf8a30b on Apr 8, 2020
- DrahtBot locked this on Sep 8, 2021