Skip to content

Commit 6da4564

Browse files
committed
Merge bitcoin/bitcoin#26259: test: Test year 2106 block timestamps
fafc96a test: Test year 2106 block timestamps (MacroFake) Pull request description: Alternative to bitcoin/bitcoin#21362 that closes bitcoin/bitcoin#21356 ACKs for top commit: Sjors: utACK fafc96a Tree-SHA512: 196d98f42d6f7f0222312b7bd1c68b3bd30cb6f0cbaccb900cfc5fcc689494adb2a7d7d6023c1ff1e8cf871047ec37eeca41386e31029d99cabf9343b4fd2a03
2 parents 085f839 + fafc96a commit 6da4564

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

test/functional/mining_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def assert_submitblock(block, result_str_1, result_str_2=None):
200200

201201
self.log.info("getblocktemplate: Test bad timestamps")
202202
bad_block = copy.deepcopy(block)
203-
bad_block.nTime = 2**31 - 1
203+
bad_block.nTime = 2**32 - 1
204204
assert_template(node, bad_block, 'time-too-new')
205205
assert_submitblock(bad_block, 'time-too-new', 'time-too-new')
206206
bad_block.nTime = 0

test/functional/rpc_blockchain.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def run_test(self):
8989
self._test_waitforblockheight()
9090
self._test_getblock()
9191
self._test_getdeploymentinfo()
92+
self._test_y2106()
9293
assert self.nodes[0].verifychain(4, 0)
9394

9495
def mine_chain(self):
@@ -255,6 +256,14 @@ def _test_getdeploymentinfo(self):
255256
# calling with an explicit hash works
256257
self.check_signalling_deploymentinfo_result(self.nodes[0].getdeploymentinfo(gbci207["bestblockhash"]), gbci207["blocks"], gbci207["bestblockhash"], "started")
257258

259+
def _test_y2106(self):
260+
self.log.info("Check that block timestamps work until year 2106")
261+
self.generate(self.nodes[0], 8)[-1]
262+
time_2106 = 2**32 - 1
263+
self.nodes[0].setmocktime(time_2106)
264+
last = self.generate(self.nodes[0], 6)[-1]
265+
assert_equal(self.nodes[0].getblockheader(last)["mediantime"], time_2106)
266+
258267
def _test_getchaintxstats(self):
259268
self.log.info("Test getchaintxstats")
260269

0 commit comments

Comments
 (0)