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)
@@ -107,5 +108,23 @@ def run_test(self):
107108 p2p_conn_low_bw .sync_with_ping ()
108109 assert_equal (p2p_conn_low_bw .last_message ['getdata' ].inv , [CInv (MSG_CMPCT_BLOCK , block1 .sha256 )])
109110
111+ self .log .info ("Test that -blocksonly nodes still serve compact blocks" )
112+
113+ def test_for_cmpctblock (block ):
114+ if 'cmpctblock' not in p2p_conn_blocksonly .last_message :
115+ return False
116+ return p2p_conn_blocksonly .last_message ['cmpctblock' ].header_and_shortids .header .rehash () == block .sha256
117+
118+ p2p_conn_blocksonly .send_message (msg_getdata ([CInv (MSG_CMPCT_BLOCK , block0 .sha256 )]))
119+ p2p_conn_blocksonly .wait_until (lambda : test_for_cmpctblock (block0 ))
120+
121+ # Request BIP152 high bandwidth mode from the -blocksonly node.
122+ p2p_conn_blocksonly .send_and_ping (msg_sendcmpct (announce = True , version = 2 ))
123+
124+ block2 = self .build_block_on_tip ()
125+ self .nodes [0 ].submitblock (block1 .serialize ().hex ())
126+ self .nodes [0 ].submitblock (block2 .serialize ().hex ())
127+ p2p_conn_blocksonly .wait_until (lambda : test_for_cmpctblock (block2 ))
128+
110129if __name__ == '__main__' :
111130 P2PCompactBlocksBlocksOnly ().main ()
You can’t perform that action at this time.
0 commit comments