From fa2cdc9ac2672301591cafceb8ff230b95425ad0 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sat, 23 Feb 2019 12:56:54 -0500 Subject: test: Simplify create_cache --- test/functional/test_framework/test_framework.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 24e1a21a28..09d7d877a7 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -277,7 +277,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): if not self.setup_clean_chain: for n in self.nodes: assert_equal(n.getblockchaininfo()["blocks"], 199) - self.log.debug('Generate a block with current time to finalize the cache and assert we are out of IBD') + # To ensure that all nodes are out of IBD, the most recent block + # must have a timestamp not too old (see IsInitialBlockDownload()). + self.log.debug('Generate a block with current time') block_hash = self.nodes[0].generate(1)[0] block = self.nodes[0].getblock(blockhash=block_hash, verbosity=0) for n in self.nodes: @@ -493,14 +495,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): # block in the cache does not age too much (have an old tip age). # This is needed so that we are out of IBD when the test starts, # see the tip age check in IsInitialBlockDownload(). - for i in range(2): - for peer in range(4): - for j in range(25): - if i == 1 and peer == 3 and j == 24: - break - self.nodes[peer].generatetoaddress(1, self.nodes[peer].get_deterministic_priv_key().address) - # Must sync before next peer starts generating blocks - sync_blocks(self.nodes) + for i in range(8): + self.nodes[0].generatetoaddress(25 if i != 7 else 24, self.nodes[i % 4].get_deterministic_priv_key().address) + sync_blocks(self.nodes) for n in self.nodes: assert_equal(n.getblockchaininfo()["blocks"], 199) -- cgit v1.2.3