aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_compactblocks_blocksonly.py
diff options
context:
space:
mode:
authorNiklas Gögge <n.goeggi@gmail.com>2021-08-08 10:08:52 +0200
committerNiklas Gögge <n.goeggi@gmail.com>2021-09-28 22:11:30 +0200
commit5e231c116ba8165e9d8c795b85ca2833238aed54 (patch)
treec6254f7f359eacd27a17bf4f28924300e3b032ac /test/functional/p2p_compactblocks_blocksonly.py
parent5bf658745782eb571215d6c1e5fe3c655edb55b3 (diff)
downloadbitcoin-5e231c116ba8165e9d8c795b85ca2833238aed54.tar.xz
[test] Test that -blocksonly nodes do not send getdata(CMPCT) on a low bandwidth connection.
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
Diffstat (limited to 'test/functional/p2p_compactblocks_blocksonly.py')
-rwxr-xr-xtest/functional/p2p_compactblocks_blocksonly.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/functional/p2p_compactblocks_blocksonly.py b/test/functional/p2p_compactblocks_blocksonly.py
index b59a81d3ec..f690fce0d6 100755
--- a/test/functional/p2p_compactblocks_blocksonly.py
+++ b/test/functional/p2p_compactblocks_blocksonly.py
@@ -80,5 +80,18 @@ class P2PCompactBlocksBlocksOnly(BitcoinTestFramework):
p2p_conn_high_bw.wait_until(lambda: p2p_conn_high_bw.message_count['sendcmpct'] == 3)
assert_equal(p2p_conn_high_bw.last_message['sendcmpct'].announce, True)
+ self.log.info("Test that -blocksonly nodes send getdata(BLOCK) instead"
+ " of getdata(CMPCT) in BIP152 low bandwidth mode")
+
+ block1 = self.build_block_on_tip()
+
+ p2p_conn_blocksonly.send_message(msg_headers(headers=[CBlockHeader(block1)]))
+ p2p_conn_blocksonly.sync_send_with_ping()
+ assert_equal(p2p_conn_blocksonly.last_message['getdata'].inv, [CInv(MSG_BLOCK | MSG_WITNESS_FLAG, block1.sha256)])
+
+ p2p_conn_high_bw.send_message(msg_headers(headers=[CBlockHeader(block1)]))
+ p2p_conn_high_bw.sync_send_with_ping()
+ assert_equal(p2p_conn_high_bw.last_message['getdata'].inv, [CInv(MSG_CMPCT_BLOCK, block1.sha256)])
+
if __name__ == '__main__':
P2PCompactBlocksBlocksOnly().main()