@@ -277,7 +277,9 @@ def setup_nodes(self):
277277 if not self .setup_clean_chain :
278278 for n in self .nodes :
279279 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' )
281283 block_hash = self .nodes [0 ].generate (1 )[0 ]
282284 block = self .nodes [0 ].getblock (blockhash = block_hash , verbosity = 0 )
283285 for n in self .nodes :
@@ -493,14 +495,9 @@ def _initialize_chain(self):
493495 # block in the cache does not age too much (have an old tip age).
494496 # This is needed so that we are out of IBD when the test starts,
495497 # 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 )
504501
505502 for n in self .nodes :
506503 assert_equal (n .getblockchaininfo ()["blocks" ], 199 )
0 commit comments