diff options
author | Jon Atack <jon@atack.com> | 2021-07-21 17:07:18 +0200 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2021-07-21 18:01:09 +0200 |
commit | 78c361086fc0bf27612e8142bd33e05e37a36af6 (patch) | |
tree | 16407ab6fbe31d16c1ccce7740c50348ff2c2582 /test/functional | |
parent | 0a9129c588ab016eb0453b40a0cae918ca4aa6a2 (diff) | |
download | bitcoin-78c361086fc0bf27612e8142bd33e05e37a36af6.tar.xz |
test: assert on mediantime in getblockheader and getblockchaininfo
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/rpc_blockchain.py | 4 |
1 files changed, 3 insertions, 1 deletions
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) |