https://github.com/bitcoin/bitcoin/pull/29575

Motivation

Banscore (later misbehavior score) used to be part of getpeerinfo but was removed back in https://github.com/bitcoin/bitcoin/pull/19469. The original idea was to get rid of the whole concept of an incremental score that will end up triggering a disconnection (ref). However, this was never fully removed, but just removed from the public interface.

The way misbehavior was assigned to peers was pretty arbitrary: some behavior would automatically trigger disconnection + discouragement, while other would be permitted up to a certain extend before facing the same outcome. Part of the reason for this to exist was fear in being to harsh and, potentially, trigger a disconnection too eagerly and end up partitioning the network (specially if someone could trigger that can of behavior for other peers). Looks like this is actually not the case, plus the approach makes it harder to test broken implementations (due to arbitrary limits).

This PR gets rid of the score altogether, making misbehaving a binary operation (that would either get you disconnected and discouraged or not have any consequence at all)

Thoughts/Questions

Increased misbehavior (immediate disconnection)

Removed misbehavior

The PR mentions: I believe that none of these behaviors are unavoidable, except for the one marked () which can in theory happen still due to interaction between BIP130 and variations in system clocks (the max 2 hour in the future rule).*

Q: How does the system clock affect BIP130 announcements? I may need to check BIP130 in more detail.

A: A block will be rejected if it is more than 2 hours in the future. If our system block is broken, we may reject any potentially connecting block because of the timestamp rule, which will make a potentially valid HEADERS message rejected. This would previously, eventually, trigger a disconnection while now it does not.

Review

First pass:

net_processing: make any misbehavior trigger immediate discouragement by sipa · Pull Request #29575 · bitcoin/bitcoin