Alternative to #21362 that closes https://github.com/bitcoin/bitcoin/issues/21356
test: Test year 2106 block timestamps #26259
pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2210-test-2106-🍓 changing 2 files +10 −1-
maflcko commented at 2:37 PM on October 5, 2022: member
- DrahtBot added the label Tests on Oct 5, 2022
- maflcko force-pushed on Oct 5, 2022
-
in test/functional/rpc_blockchain.py:259 in cccccc5934 outdated
255 | @@ -255,6 +256,13 @@ def _test_getdeploymentinfo(self): 256 | # calling with an explicit hash works 257 | self.check_signalling_deploymentinfo_result(self.nodes[0].getdeploymentinfo(gbci207["bestblockhash"]), gbci207["blocks"], gbci207["bestblockhash"], "started") 258 | 259 | + def _test_y2106(self):
Sjors commented at 11:50 AM on October 6, 2022:You should clarify what this is testing.
maflcko commented at 1:20 PM on October 6, 2022:I think the code is simple and self-explanatory, no?
Sjors commented at 11:12 AM on October 20, 2022:Maybe, the function name suggests this is testing the 2106 bug. Could rename to e.g.
_test_y2106-1sor something.
maflcko commented at 12:46 PM on October 20, 2022:Thanks, added info print
fafc96aaf4test: Test year 2106 block timestamps
* Use maximum timestamp in getblocktemplate test * Mine block with maximum timestamp and MTP in blockchain test
in test/functional/rpc_blockchain.py:265 in cccccc5934 outdated
255 | @@ -255,6 +256,13 @@ def _test_getdeploymentinfo(self): 256 | # calling with an explicit hash works 257 | self.check_signalling_deploymentinfo_result(self.nodes[0].getdeploymentinfo(gbci207["bestblockhash"]), gbci207["blocks"], gbci207["bestblockhash"], "started") 258 | 259 | + def _test_y2106(self): 260 | + self.generate(self.nodes[0], 8)[-1] 261 | + time_2106 = 2**32 - 1 262 | + self.nodes[0].setmocktime(time_2106) 263 | + last = self.generate(self.nodes[0], 6)[-1] 264 | + assert_equal(self.nodes[0].getblockheader(last)["mediantime"], time_2106)
Sjors commented at 12:02 PM on October 6, 2022:Might as well generate one more block to trigger the (other) 2106 bug:
time-too-old, block's timestamp is too early
maflcko commented at 1:19 PM on October 6, 2022:I'd rather not, because this would require the whole file to be ignored by the
implicit-signed-integer-truncationsanitizer:node0 stderr node/miner.cpp:36:25: runtime error: implicit conversion from type 'int64_t' (aka 'long') of value 4294967296 (64-bit, signed) to type 'uint32_t' (aka 'unsigned int') changed the value to 0 (32-bit, unsigned)maflcko force-pushed on Oct 20, 2022Sjors commented at 8:01 AM on October 21, 2022: memberutACK fafc96a
fanquake merged this on Oct 21, 2022fanquake closed this on Oct 21, 2022maflcko deleted the branch on Oct 21, 2022sidhujag referenced this in commit ac491b0e47 on Oct 23, 2022bitcoin locked this on Oct 21, 2023Labels
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-24 09:14 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-24 09:14 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me