@brunoerg:
MAX_BLOCK_WEIGHT + 4 is the smallest over-weight block you can reach if you only change non-witness data (as in this test scenario, the scriptPubKey), as every byte added increases the block weight by 4 WU
(What you probably meant was
(MAX_BLOCK_BASE_SIZE + 1) * 4 but that constant doesn’t exist anymore in this PR :))
@MarcoFalke: yes I guess it’s possible to reach exactly MAX_BLOCK_WEIGHT+1 by tweaking the witness. Didn’t want to change too much of the surrounding logic though, can be done in a follow-up I guess. E.g. adding test coverage for the rejection state
bad-blk-weight is on my TODO list, it could be appropriate to include it in such a PR.