Skip to content

Commit 5e231c1

Browse files
[test] Test that -blocksonly nodes do not send getdata(CMPCT) on a low bandwidth connection.
Co-authored-by: Amiti Uttarwar <[email protected]>
1 parent 5bf6587 commit 5e231c1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/functional/p2p_compactblocks_blocksonly.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,18 @@ def run_test(self):
8080
p2p_conn_high_bw.wait_until(lambda: p2p_conn_high_bw.message_count['sendcmpct'] == 3)
8181
assert_equal(p2p_conn_high_bw.last_message['sendcmpct'].announce, True)
8282

83+
self.log.info("Test that -blocksonly nodes send getdata(BLOCK) instead"
84+
" of getdata(CMPCT) in BIP152 low bandwidth mode")
85+
86+
block1 = self.build_block_on_tip()
87+
88+
p2p_conn_blocksonly.send_message(msg_headers(headers=[CBlockHeader(block1)]))
89+
p2p_conn_blocksonly.sync_send_with_ping()
90+
assert_equal(p2p_conn_blocksonly.last_message['getdata'].inv, [CInv(MSG_BLOCK | MSG_WITNESS_FLAG, block1.sha256)])
91+
92+
p2p_conn_high_bw.send_message(msg_headers(headers=[CBlockHeader(block1)]))
93+
p2p_conn_high_bw.sync_send_with_ping()
94+
assert_equal(p2p_conn_high_bw.last_message['getdata'].inv, [CInv(MSG_CMPCT_BLOCK, block1.sha256)])
95+
8396
if __name__ == '__main__':
8497
P2PCompactBlocksBlocksOnly().main()

0 commit comments

Comments
 (0)