diff options
author | MacroFake <falke.marco@gmail.com> | 2022-06-15 08:19:42 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-06-15 08:19:45 +0200 |
commit | a57492f65df78be353923f321d5b4a7f586417a9 (patch) | |
tree | 04e08237f68288f90d768db0477673499664257c /test/functional | |
parent | ede90890969152b5c13ea21e57490fcb8d5c3b70 (diff) | |
parent | 5a8c321444c10c7c89c4222c0b47c2d83a1a9ea4 (diff) | |
download | bitcoin-a57492f65df78be353923f321d5b4a7f586417a9.tar.xz |
Merge bitcoin/bitcoin#25370: test: check for `getblocktxn` request with out-of-bounds tx index
5a8c321444c10c7c89c4222c0b47c2d83a1a9ea4 test: check for `getblocktxn` request with out-of-bounds tx index (Sebastian Falbesoner)
Pull request description:
This PR adds missing test coverage for the `getblocktxn` message handler, in the case that any of the contained indices is out-of-bounds:
https://github.com/bitcoin/bitcoin/blob/a05876619a3307daefec0946de8e3cbbe5b0157f/src/net_processing.cpp#L2180-L2183
ACKs for top commit:
dunxen:
ACK 5a8c321
Tree-SHA512: 2743c2c6d8aed57b22f825aefd60ba3e670321b60625a42ea7248e7b0fc41c73e9a5945153567c02824ba3b5f0fce7f4125bffc974973fc608b6ffbe49e14b65
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/p2p_compactblocks.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/functional/p2p_compactblocks.py b/test/functional/p2p_compactblocks.py index b9ac3c32c5..5e50e1ebce 100755 --- a/test/functional/p2p_compactblocks.py +++ b/test/functional/p2p_compactblocks.py @@ -606,6 +606,15 @@ class CompactBlocksTest(BitcoinTestFramework): assert_equal(test_node.last_message["block"].block.sha256, int(block_hash, 16)) assert "blocktxn" not in test_node.last_message + # Request with out-of-bounds tx index results in disconnect + bad_peer = self.nodes[0].add_p2p_connection(TestP2PConn()) + block_hash = node.getblockhash(chain_height) + block = from_hex(CBlock(), node.getblock(block_hash, False)) + msg.block_txn_request = BlockTransactionsRequest(int(block_hash, 16), [len(block.vtx)]) + with node.assert_debug_log(['getblocktxn with out-of-bounds tx indices']): + bad_peer.send_message(msg) + bad_peer.wait_for_disconnect() + def test_compactblocks_not_at_tip(self, test_node): node = self.nodes[0] # Test that requesting old compactblocks doesn't work. |