Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Test year 2106 block timestamps #26259

Merged
merged 1 commit into from Oct 21, 2022

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Oct 5, 2022

Alternative to #21362 that closes #21356

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well generate one more block to trigger the (other) 2106 bug: time-too-old, block's timestamp is too early

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not, because this would require the whole file to be ignored by the implicit-signed-integer-truncation sanitizer:

 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)

* Use maximum timestamp in getblocktemplate test
* Mine block with maximum timestamp and MTP in blockchain test
@Sjors
Copy link
Member

Sjors commented Oct 21, 2022

utACK fafc96a

@fanquake fanquake merged commit 6da4564 into bitcoin:master Oct 21, 2022
@maflcko maflcko deleted the 2210-test-2106-🍓 branch October 21, 2022 09:32
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 23, 2022
fafc96a test: Test year 2106 block timestamps (MacroFake)

Pull request description:

  Alternative to bitcoin#21362 that closes bitcoin#21356

ACKs for top commit:
  Sjors:
    utACK fafc96a

Tree-SHA512: 196d98f42d6f7f0222312b7bd1c68b3bd30cb6f0cbaccb900cfc5fcc689494adb2a7d7d6023c1ff1e8cf871047ec37eeca41386e31029d99cabf9343b4fd2a03
@bitcoin bitcoin locked and limited conversation to collaborators Oct 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Year 2038 time bug
4 participants