aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-02-23 12:56:54 -0500
committerMarcoFalke <falke.marco@gmail.com>2019-02-25 11:18:24 -0500
commitfa2cdc9ac2672301591cafceb8ff230b95425ad0 (patch)
tree2ccc551e83a884f1af58435bead84018773049dd
parentfa25210d6266d50a6c2bfd6d96062bacb2ae393b (diff)
test: Simplify create_cache
-rwxr-xr-xtest/functional/test_framework/test_framework.py15
1 files changed, 6 insertions, 9 deletions
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)