Skip to content

Commit

Permalink
test: assert on mediantime in getblockheader and getblockchaininfo
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatack committed Jul 21, 2021
1 parent 0a9129c commit 78c3610
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/functional/rpc_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@


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


Expand Down Expand Up @@ -103,6 +104,7 @@ def _test_getblockchaininfo(self):
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))
Expand Down Expand Up @@ -310,7 +312,7 @@ def _test_getblockheader(self):
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)
Expand Down

0 comments on commit 78c3610

Please sign in to comment.