@@ -579,14 +579,14 @@ def run_test(self):
579
579
while b47 .sha256 < target :
580
580
b47 .nNonce += 1
581
581
b47 .rehash ()
582
- self .sync_blocks ([b47 ], False , request_block = False )
582
+ self .sync_blocks ([b47 ], False , force_send = True , reject_reason = 'high-hash' )
583
583
584
584
self .log .info ("Reject a block with a timestamp >2 hours in the future" )
585
585
self .move_tip (44 )
586
586
b48 = self .next_block (48 , solve = False )
587
587
b48 .nTime = int (time .time ()) + 60 * 60 * 3
588
588
b48 .solve ()
589
- self .sync_blocks ([b48 ], False , request_block = False )
589
+ self .sync_blocks ([b48 ], False , force_send = True , reject_reason = 'time-too-new' )
590
590
591
591
self .log .info ("Reject a block with invalid merkle hash" )
592
592
self .move_tip (44 )
@@ -600,7 +600,7 @@ def run_test(self):
600
600
b50 = self .next_block (50 )
601
601
b50 .nBits = b50 .nBits - 1
602
602
b50 .solve ()
603
- self .sync_blocks ([b50 ], False , request_block = False , reconnect = True )
603
+ self .sync_blocks ([b50 ], False , force_send = True , reject_reason = 'bad-diffbits' , reconnect = True )
604
604
605
605
self .log .info ("Reject a block with two coinbase transactions" )
606
606
self .move_tip (44 )
@@ -630,7 +630,7 @@ def run_test(self):
630
630
b54 = self .next_block (54 , spend = out [15 ])
631
631
b54 .nTime = b35 .nTime - 1
632
632
b54 .solve ()
633
- self .sync_blocks ([b54 ], False , request_block = False )
633
+ self .sync_blocks ([b54 ], False , force_send = True , reject_reason = 'time-too-old' )
634
634
635
635
# valid timestamp
636
636
self .move_tip (53 )
@@ -1078,11 +1078,11 @@ def run_test(self):
1078
1078
1079
1079
self .move_tip (77 )
1080
1080
b80 = self .next_block (80 , spend = out [25 ])
1081
- self .sync_blocks ([b80 ], False , request_block = False )
1081
+ self .sync_blocks ([b80 ], False , force_send = True )
1082
1082
self .save_spendable_output ()
1083
1083
1084
1084
b81 = self .next_block (81 , spend = out [26 ])
1085
- self .sync_blocks ([b81 ], False , request_block = False ) # other chain is same length
1085
+ self .sync_blocks ([b81 ], False , force_send = True ) # other chain is same length
1086
1086
self .save_spendable_output ()
1087
1087
1088
1088
b82 = self .next_block (82 , spend = out [27 ])
@@ -1189,7 +1189,7 @@ def run_test(self):
1189
1189
blocks2 = []
1190
1190
for i in range (89 , LARGE_REORG_SIZE + 89 ):
1191
1191
blocks2 .append (self .next_block ("alt" + str (i )))
1192
- self .sync_blocks (blocks2 , False , request_block = False )
1192
+ self .sync_blocks (blocks2 , False , force_send = True )
1193
1193
1194
1194
# extend alt chain to trigger re-org
1195
1195
block = self .next_block ("alt" + str (chain1_tip + 1 ))
@@ -1198,7 +1198,7 @@ def run_test(self):
1198
1198
# ... and re-org back to the first chain
1199
1199
self .move_tip (chain1_tip )
1200
1200
block = self .next_block (chain1_tip + 1 )
1201
- self .sync_blocks ([block ], False , request_block = False )
1201
+ self .sync_blocks ([block ], False , force_send = True )
1202
1202
block = self .next_block (chain1_tip + 2 )
1203
1203
self .sync_blocks ([block ], True , timeout = 180 )
1204
1204
@@ -1309,14 +1309,15 @@ def reconnect_p2p(self):
1309
1309
self .nodes [0 ].disconnect_p2ps ()
1310
1310
self .bootstrap_p2p ()
1311
1311
1312
- def sync_blocks (self , blocks , success = True , reject_reason = None , request_block = True , reconnect = False , timeout = 60 ):
1312
+ def sync_blocks (self , blocks , success = True , reject_reason = None , force_send = False , reconnect = False , timeout = 60 ):
1313
1313
"""Sends blocks to test node. Syncs and verifies that tip has advanced to most recent block.
1314
1314
1315
1315
Call with success = False if the tip shouldn't advance to the most recent block."""
1316
- self .nodes [0 ].p2p .send_blocks_and_test (blocks , self .nodes [0 ], success = success , reject_reason = reject_reason , request_block = request_block , timeout = timeout , expect_disconnect = reconnect )
1316
+ self .nodes [0 ].p2p .send_blocks_and_test (blocks , self .nodes [0 ], success = success , reject_reason = reject_reason , force_send = force_send , timeout = timeout , expect_disconnect = reconnect )
1317
1317
1318
1318
if reconnect :
1319
1319
self .reconnect_p2p ()
1320
1320
1321
+
1321
1322
if __name__ == '__main__' :
1322
1323
FullBlockTest ().main ()
0 commit comments