test: Check that invalid peer traffic is accounted for
test: Check that invalid peer traffic is accounted for

Summary:
> Couldn't find a test for this and it seems something we should test, so I wrote one.

Commits:
> test: Remove confusing cast to same type (int to int)

> test: Check that invalid peer traffic is accounted for

This is a backport of [[https://github.com/bitcoin/bitcoin/pull/20028 | core#20028]]

Backport notes:
 - we ban for a bad checksum (see D2289), so the change in `test_checksum` is not applicable
 - the change in indentation for `self.nodes[0].disconnect_p2ps()` on line 144 was supposed to be done in D9530. It does not affect the behavior, it just moves a cleanup disconnection outside the assertion scope

Test Plan: `test/functional/test_runner.py p2p_invalid_messages`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10348

Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc