Skip to content

Commit 78c3610

Browse files
committed
test: assert on mediantime in getblockheader and getblockchaininfo
1 parent 0a9129c commit 78c3610

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/functional/rpc_blockchain.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050

5151

5252
TIME_RANGE_STEP = 600 # ten-minute steps
53+
TIME_RANGE_MTP = TIME_GENESIS_BLOCK + 194 * TIME_RANGE_STEP
5354
TIME_RANGE_END = TIME_GENESIS_BLOCK + 200 * TIME_RANGE_STEP
5455

5556

@@ -103,6 +104,7 @@ def _test_getblockchaininfo(self):
103104
res = self.nodes[0].getblockchaininfo()
104105

105106
assert_equal(res['time'], TIME_RANGE_END - TIME_RANGE_STEP)
107+
assert_equal(res['mediantime'], TIME_RANGE_MTP)
106108

107109
# result should have these additional pruning keys if manual pruning is enabled
108110
assert_equal(sorted(res.keys()), sorted(['pruneheight', 'automatic_pruning'] + keys))
@@ -310,7 +312,7 @@ def _test_getblockheader(self):
310312
assert_is_hash_string(header['merkleroot'])
311313
assert_is_hash_string(header['bits'], length=None)
312314
assert isinstance(header['time'], int)
313-
assert isinstance(header['mediantime'], int)
315+
assert_equal(header['mediantime'], TIME_RANGE_MTP)
314316
assert isinstance(header['nonce'], int)
315317
assert isinstance(header['version'], int)
316318
assert isinstance(int(header['versionHex'], 16), int)

0 commit comments

Comments
 (0)