49
49
from test_framework .wallet import MiniWallet
50
50
51
51
52
+ TIME_RANGE_STEP = 600 # ten-minute steps
53
+ TIME_RANGE_END = TIME_GENESIS_BLOCK + 200 * TIME_RANGE_STEP
54
+
55
+
52
56
class BlockchainTest (BitcoinTestFramework ):
53
57
def set_test_params (self ):
54
58
self .setup_clean_chain = True
@@ -71,9 +75,8 @@ def run_test(self):
71
75
assert self .nodes [0 ].verifychain (4 , 0 )
72
76
73
77
def mine_chain (self ):
74
- self .log .info ('Create some old blocks' )
75
- for t in range (TIME_GENESIS_BLOCK , TIME_GENESIS_BLOCK + 200 * 600 , 600 ):
76
- # ten-minute steps from genesis block time
78
+ self .log .info ("Generate 200 blocks after the genesis block in ten-minute steps" )
79
+ for t in range (TIME_GENESIS_BLOCK , TIME_RANGE_END , TIME_RANGE_STEP ):
77
80
self .nodes [0 ].setmocktime (t )
78
81
self .nodes [0 ].generatetoaddress (1 , ADDRESS_BCRT1_P2WSH_OP_TRUE )
79
82
assert_equal (self .nodes [0 ].getblockchaininfo ()['blocks' ], 200 )
@@ -99,7 +102,7 @@ def _test_getblockchaininfo(self):
99
102
]
100
103
res = self .nodes [0 ].getblockchaininfo ()
101
104
102
- assert isinstance (res ['time' ], int )
105
+ assert_equal (res ['time' ], TIME_RANGE_END - TIME_RANGE_STEP )
103
106
104
107
# result should have these additional pruning keys if manual pruning is enabled
105
108
assert_equal (sorted (res .keys ()), sorted (['pruneheight' , 'automatic_pruning' ] + keys ))
0 commit comments