test: Cache 25 mature coins for ADDRESS_BCRT1_P2WSH_OP_TRUE

pull/826/head
MarcoFalke 4 years ago
parent fad25153f5
commit fa4d8f3169
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

@ -19,6 +19,7 @@ import tempfile
import time import time
from typing import List from typing import List
from .address import ADDRESS_BCRT1_P2WSH_OP_TRUE
from .authproxy import JSONRPCException from .authproxy import JSONRPCException
from . import coverage from . import coverage
from .p2p import NetworkThread from .p2p import NetworkThread
@ -732,16 +733,17 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
# Set a time in the past, so that blocks don't end up in the future # Set a time in the past, so that blocks don't end up in the future
cache_node.setmocktime(cache_node.getblockheader(cache_node.getbestblockhash())['time']) cache_node.setmocktime(cache_node.getblockheader(cache_node.getbestblockhash())['time'])
# Create a 199-block-long chain; each of the 4 first nodes # Create a 199-block-long chain; each of the 3 first nodes
# gets 25 mature blocks and 25 immature. # gets 25 mature blocks and 25 immature.
# The 4th node gets only 24 immature blocks so that the very last # The 4th address gets 25 mature and only 24 immature blocks so that the very last
# block in the cache does not age too much (have an old tip age). # 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, # This is needed so that we are out of IBD when the test starts,
# see the tip age check in IsInitialBlockDownload(). # see the tip age check in IsInitialBlockDownload().
gen_addresses = [k.address for k in TestNode.PRIV_KEYS] + [ADDRESS_BCRT1_P2WSH_OP_TRUE]
for i in range(8): for i in range(8):
cache_node.generatetoaddress( cache_node.generatetoaddress(
nblocks=25 if i != 7 else 24, nblocks=25 if i != 7 else 24,
address=TestNode.PRIV_KEYS[i % 4].address, address=gen_addresses[i % 4],
) )
assert_equal(cache_node.getblockchaininfo()["blocks"], 199) assert_equal(cache_node.getblockchaininfo()["blocks"], 199)

Loading…
Cancel
Save