@@ -277,7 +277,9 @@ def setup_nodes(self):
277
277
if not self .setup_clean_chain :
278
278
for n in self .nodes :
279
279
assert_equal (n .getblockchaininfo ()["blocks" ], 199 )
280
- self .log .debug ('Generate a block with current time to finalize the cache and assert we are out of IBD' )
280
+ # To ensure that all nodes are out of IBD, the most recent block
281
+ # must have a timestamp not too old (see IsInitialBlockDownload()).
282
+ self .log .debug ('Generate a block with current time' )
281
283
block_hash = self .nodes [0 ].generate (1 )[0 ]
282
284
block = self .nodes [0 ].getblock (blockhash = block_hash , verbosity = 0 )
283
285
for n in self .nodes :
@@ -493,14 +495,9 @@ def _initialize_chain(self):
493
495
# block in the cache does not age too much (have an old tip age).
494
496
# This is needed so that we are out of IBD when the test starts,
495
497
# see the tip age check in IsInitialBlockDownload().
496
- for i in range (2 ):
497
- for peer in range (4 ):
498
- for j in range (25 ):
499
- if i == 1 and peer == 3 and j == 24 :
500
- break
501
- self .nodes [peer ].generatetoaddress (1 , self .nodes [peer ].get_deterministic_priv_key ().address )
502
- # Must sync before next peer starts generating blocks
503
- sync_blocks (self .nodes )
498
+ for i in range (8 ):
499
+ self .nodes [0 ].generatetoaddress (25 if i != 7 else 24 , self .nodes [i % 4 ].get_deterministic_priv_key ().address )
500
+ sync_blocks (self .nodes )
504
501
505
502
for n in self .nodes :
506
503
assert_equal (n .getblockchaininfo ()["blocks" ], 199 )
0 commit comments