mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
test: Test year 2106 block timestamps
* Use maximum timestamp in getblocktemplate test * Mine block with maximum timestamp and MTP in blockchain test
This commit is contained in:
parent
a97791d9fb
commit
fafc96aaf4
2 changed files with 10 additions and 1 deletions
|
@ -200,7 +200,7 @@ class MiningTest(BitcoinTestFramework):
|
||||||
|
|
||||||
self.log.info("getblocktemplate: Test bad timestamps")
|
self.log.info("getblocktemplate: Test bad timestamps")
|
||||||
bad_block = copy.deepcopy(block)
|
bad_block = copy.deepcopy(block)
|
||||||
bad_block.nTime = 2**31 - 1
|
bad_block.nTime = 2**32 - 1
|
||||||
assert_template(node, bad_block, 'time-too-new')
|
assert_template(node, bad_block, 'time-too-new')
|
||||||
assert_submitblock(bad_block, 'time-too-new', 'time-too-new')
|
assert_submitblock(bad_block, 'time-too-new', 'time-too-new')
|
||||||
bad_block.nTime = 0
|
bad_block.nTime = 0
|
||||||
|
|
|
@ -89,6 +89,7 @@ class BlockchainTest(BitcoinTestFramework):
|
||||||
self._test_waitforblockheight()
|
self._test_waitforblockheight()
|
||||||
self._test_getblock()
|
self._test_getblock()
|
||||||
self._test_getdeploymentinfo()
|
self._test_getdeploymentinfo()
|
||||||
|
self._test_y2106()
|
||||||
assert self.nodes[0].verifychain(4, 0)
|
assert self.nodes[0].verifychain(4, 0)
|
||||||
|
|
||||||
def mine_chain(self):
|
def mine_chain(self):
|
||||||
|
@ -255,6 +256,14 @@ class BlockchainTest(BitcoinTestFramework):
|
||||||
# calling with an explicit hash works
|
# calling with an explicit hash works
|
||||||
self.check_signalling_deploymentinfo_result(self.nodes[0].getdeploymentinfo(gbci207["bestblockhash"]), gbci207["blocks"], gbci207["bestblockhash"], "started")
|
self.check_signalling_deploymentinfo_result(self.nodes[0].getdeploymentinfo(gbci207["bestblockhash"]), gbci207["blocks"], gbci207["bestblockhash"], "started")
|
||||||
|
|
||||||
|
def _test_y2106(self):
|
||||||
|
self.log.info("Check that block timestamps work until year 2106")
|
||||||
|
self.generate(self.nodes[0], 8)[-1]
|
||||||
|
time_2106 = 2**32 - 1
|
||||||
|
self.nodes[0].setmocktime(time_2106)
|
||||||
|
last = self.generate(self.nodes[0], 6)[-1]
|
||||||
|
assert_equal(self.nodes[0].getblockheader(last)["mediantime"], time_2106)
|
||||||
|
|
||||||
def _test_getchaintxstats(self):
|
def _test_getchaintxstats(self):
|
||||||
self.log.info("Test getchaintxstats")
|
self.log.info("Test getchaintxstats")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue