Because the call to MaybePunishNode() in
PeerLogicValidation::BlockChecked() only previously happened if the
REJECT code was > 0 and < REJECT_INTERNAL, then there are cases were
MaybePunishNode() can get called where it wasn't previously:
- when AcceptBlockHeader() fails with CACHED_INVALID.
- when AcceptBlockHeader() fails with BLOCK_MISSING_PREV.
Note that BlockChecked() cannot fail with an 'internal' reject code. The
only internal reject code was REJECT_HIGHFEE, which was only set in
ATMP.This change restores the behaviour pre-commit
https://github.com/bitcoin/bitcoin/commit/5d08c9c579ba8cc7b684105c6a08263992b08d52
which did punish nodes that
sent us CACHED_INVALID and BLOCK_MISSING_PREV blocks.
This is a backport of Core PR17004 [1/5]
Commit https://github.com/bitcoin/bitcoin/pull/17004/commits/a1a07cfe99fc8cee30ba5976dc36b47b1f6532ab