File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1313 CInv ,
1414 from_hex ,
1515 msg_block ,
16+ msg_getdata ,
1617 msg_headers ,
1718 msg_sendcmpct ,
1819)
@@ -106,5 +107,23 @@ def run_test(self):
106107 p2p_conn_low_bw .sync_with_ping ()
107108 assert_equal (p2p_conn_low_bw .last_message ['getdata' ].inv , [CInv (MSG_CMPCT_BLOCK , block1 .sha256 )])
108109
110+ self .log .info ("Test that -blocksonly nodes still serve compact blocks." )
111+
112+ def test_for_cmpctblock (block ):
113+ if 'cmpctblock' not in p2p_conn_blocksonly .last_message :
114+ return False
115+ return p2p_conn_blocksonly .last_message ['cmpctblock' ].header_and_shortids .header .rehash () == block .sha256
116+
117+ p2p_conn_blocksonly .send_message (msg_getdata ([CInv (MSG_CMPCT_BLOCK , block0 .sha256 )]))
118+ p2p_conn_blocksonly .wait_until (lambda : test_for_cmpctblock (block0 ))
119+
120+ # Request BIP152 high bandwidth mode from the -blocksonly node.
121+ p2p_conn_blocksonly .send_and_ping (msg_sendcmpct (announce = True , version = 2 ))
122+
123+ block2 = self .build_block_on_tip ()
124+ self .nodes [0 ].submitblock (block1 .serialize ().hex ())
125+ self .nodes [0 ].submitblock (block2 .serialize ().hex ())
126+ p2p_conn_blocksonly .wait_until (lambda : test_for_cmpctblock (block2 ))
127+
109128if __name__ == '__main__' :
110129 P2PCompactBlocksBlocksOnly ().main ()
You can’t perform that action at this time.
0 commit comments