[test] Test that -blocksonly nodes do not send getdata(CMPCT) on a low bandwidth connection.

Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
pull/22340/head
Niklas Gögge 3 years ago
parent 5bf6587457
commit 5e231c116b

@ -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()

Loading…
Cancel
Save