From 78c361086fc0bf27612e8142bd33e05e37a36af6 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Wed, 21 Jul 2021 17:07:18 +0200 Subject: test: assert on mediantime in getblockheader and getblockchaininfo --- test/functional/rpc_blockchain.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/functional/rpc_blockchain.py') diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py index 01f5ce7eb0..524268ecba 100755 --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -50,6 +50,7 @@ from test_framework.wallet import MiniWallet TIME_RANGE_STEP = 600 # ten-minute steps +TIME_RANGE_MTP = TIME_GENESIS_BLOCK + 194 * TIME_RANGE_STEP TIME_RANGE_END = TIME_GENESIS_BLOCK + 200 * TIME_RANGE_STEP @@ -103,6 +104,7 @@ class BlockchainTest(BitcoinTestFramework): res = self.nodes[0].getblockchaininfo() assert_equal(res['time'], TIME_RANGE_END - TIME_RANGE_STEP) + assert_equal(res['mediantime'], TIME_RANGE_MTP) # result should have these additional pruning keys if manual pruning is enabled assert_equal(sorted(res.keys()), sorted(['pruneheight', 'automatic_pruning'] + keys)) @@ -310,7 +312,7 @@ class BlockchainTest(BitcoinTestFramework): assert_is_hash_string(header['merkleroot']) assert_is_hash_string(header['bits'], length=None) assert isinstance(header['time'], int) - assert isinstance(header['mediantime'], int) + assert_equal(header['mediantime'], TIME_RANGE_MTP) assert isinstance(header['nonce'], int) assert isinstance(header['version'], int) assert isinstance(int(header['versionHex'], 16), int) -- cgit v1.2.3