Misbehaving has a lot of issues:
- It discourages and disconnects all peers on the same address as the misbehaving peer. This may disconnect honest peers that share the same address. Also, it gives a false sense of security, considering that malicious actors can trivially work around that by using ipv6 addresses or hopping ipv4 addresses in "the cloud", both of which are cheap to do.
- It does not disconnect manual connections. This may keep untrusted manual connections connected even though they violate the protocol. It would be better to only keep the connection if the user explicitly asked for the manual connection to be tagged with the
nobanpermission flag.
This is the first change in a series fixing the issues.
For reference, BIP 152 does not specify what should happen when the getblocktxn message is corrupt [1]. However, disconnecting the remote peer seems preferable, to allow them to recover instead of stalling.
[1]: https://en.bitcoin.it/wiki/BIP_0152#getblocktxn:
Upon receipt of a properly-formatted getblocktxn message, nodes which recently provided the sender of such a message a cmpctblock for the block hash identified in this message MUST respond with either an appropriate blocktxn message, or a full block message. A blocktxn response MUST contain exactly and only each transaction which is present in the appropriate block at the index specified in the getblocktxn indexes list, in the order requested.