Fix misbehave disconnect bug introduced in #4378 #4543

pull rebroad wants to merge 1 commits into bitcoin:master from rebroad:FixMisbehaveDisconnect changing 1 files +1 −3
  1. rebroad commented at 4:42 AM on July 16, 2014: contributor

    #4378 introduced a bug so that a node would never be disconnected if any single instance of misbehavior was equal to or greater than the total amount of misbehavior permitted.

  2. Fix bug intoduced in #4378 6583b60a5d
  3. rebroad renamed this:
    Fix misbehave disconnect bug intoduced in #4378
    Fix misbehave disconnect bug introduced in #4378
    on Jul 16, 2014
  4. gmaxwell commented at 4:56 AM on July 16, 2014: contributor

    huh? Now it will spam the threshold exceeded on a whitelisted peer that doesn't get banned.

    AFAICT there is no bug here either: misbehaving = 0 howmuch = 1000 misbehaving += howmuch (1000 >= 100 && 1000 - 1000 < 100) is true.

  5. BitcoinPullTester commented at 5:16 AM on July 16, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4543_6583b60a5d7304774e52ca8a572a3941d882051f/ 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.

  6. rebroad commented at 10:48 AM on July 16, 2014: contributor

    @gmaxwell There's a LogPrintf in both parts of the if, so it'll still show as many messages as before - the code as it was (and after this fix) is correct, it should display when the threshold is exceeded. The only difference should be that it doesn't disconnect whitelisted nodes, and the code where the disconnect is done should have the code to exclude the whitelisted nodes. The misbehaving function itself doesn't need to change.

    Oh... goodness.. the code is so confusing currently. Why doesn't the Misbehave function deal with pto->fWhitelisted and LogPrint appropriately? It doesn't need an extra message later on in the code to say that it's going to ignore the fShouldBan that Misbehave set... I'll fix the spam issue and push another update...

  7. rebroad closed this on Jul 16, 2014

  8. rebroad commented at 10:55 AM on July 16, 2014: contributor

    This separation of node and state seems to be more of a headache than it's worth sometimes....

  9. gmaxwell commented at 11:51 AM on July 16, 2014: contributor

    There is no need for it to deal with Whitelisted. The change here was to make it not keep repeating THRESHOLD EXCEEDED when it was already past the threshold.

  10. DrahtBot locked this on Feb 15, 2022

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-19 12:15 UTC

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