mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-09 21:47:34 +01:00
c9dacd958dtest: Check that non empty version packet is ignored and no disconnection happens (stratospher)997cc00b95test: Check that disconnection happens when AAD isn't filled (stratospher)b5e6238fdbtest: Check that disconnection happens when garbage sent/received are different (stratospher)ad1482d5a2test: Check that disconnection happens when wrong garbage terminator is sent (stratospher)e351576862test: Check that disconnection happens when >4095 garbage bytes is sent (stratospher)e075fd131dtest: Introduce test types and modify v2 handshake function accordingly (stratospher)7d07daa623log: Add V2 handshake timeout (stratospher)d4a1da8543test: Make global TRANSPORT_VERSION variable an instance variable (stratospher)c642b08c4etest: Log when the garbage is actually sent to transport layer (stratospher)86cca2cba2test: Support disconnect waiting for add_p2p_connection (stratospher)bf9669af9ctest: Rename early key response test and move random_bitflip to util (stratospher) Pull request description: Add tests for the following v2 handshake scenarios: 1. Disconnection happens when > `MAX_GARBAGE_LEN` bytes garbage is sent 2. Disconnection happens when incorrect garbage terminator is sent 3. Disconnection happens when garbage bytes are tampered with 4. Disconnection happens when AAD of first encrypted packet after the garbage terminator is not filled 5. bitcoind ignores non-empty version packet and no disconnection happens All these tests require a modified v2 P2P class (different from `EncryptedP2PState` used in `v2_p2p.py`) to implement our custom handshake behaviour based on different scenarios and have been kept in a single test file (`test/functional/p2p_v2_misbehaving.py`). Shifted the test in `test/functional/p2p_v2_earlykeyresponse.py` which is of the same pattern to this file too. ACKs for top commit: achow101: ACKc9dacd958dmzumsande: ACKc9dacd958dtheStack: Code-review ACKc9dacd958dTree-SHA512: 90df81f0c7f4ecf0a47762d290a618ded92cde9f83d3ef3cc70e1b005ecb16125ec39a9d80ce95f99e695d29abd63443240cb5490aa57c5bc8fa2e52149a0672