-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
BIP94: Change timewarp delta to 7200 seconds #1658
Conversation
2 hours is 7200, not 720. |
92e792e
to
bce34f6
Compare
bce34f6
to
0c2a217
Compare
Fixed, also slightly changed the wording and added some additional explanation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I'm curious about the original author's take on this, @TheBlueMatt. Although we can always change the number later if this is proposed for mainnet, that would either complicate the consensus code with another if branch, or require us to drop / fork testnet4 (or hope we never hit an edge case). There's two additional reasons that make the number 600 nice:
Looking around a bit more, there's a mailinglist post from 2018 Johnson Lau who called this number
He then considered that even "t=86400 (one day)" would probably be safe enough, so the choice of 7200 should be fine here. All that said, I think it makes sense to make it safe for honest miners to just use their system time when producing a block. Though even with this change I'm not sure if that's really safe behavior. Our own code does the following ( pblock->nTime = TicksSinceEpoch<std::chrono::seconds>(NodeClock::now());
...
UpdateTime(pblock, ...)
int64_t UpdateTime(CBlockHeader* pblock, ...)
{
int64_t nOldTime = pblock->nTime;
int64_t nNewTime{std::max<int64_t>(pindexPrev->GetMedianTimePast() + 1, TicksSinceEpoch<std::chrono::seconds>(NodeClock::now()))};
if (nOldTime < nNewTime) {
pblock->nTime = nNewTime;
} In other words, we pick the system time, and if needed bump it to MTP + 1. I think this would indeed get us in trouble under the timewarp rule if t=600, when the previous block is > 600 seconds in the future. |
I don't think there's much reason to care about miners being able to mine at their system time. Mining devices generally don't have clocks that are robust anyway, they just roll nTime from where the mining work producer told them to start. And, indeed, like @Sjors points out, its nice to maximally restrict here. |
This seemed like a good idea to me at the time but I can't really judge this since I don't know the mining landscape enough. What time do the honest pools usually use then? I would have assumed they just use the easiest thing. We could still make the switch to 600 if there is a preference for it. There don't seem to be any shenanigans on the network so far, I could sync fine with the 600 delta. |
Maybe we should hash this out (haha) in a Delving or mailinglist post. |
If we even maybe want to use 600 on mainnet we should use testnet to test whether anyone's stuff breaks :) |
I find @TheBlueMatt’s points convincing, and must admit, that I have little insight into miners’ setups. My concern regarding the timestamp being limited 2h in the future and therefore honest miners potentially running out of a 10 minute range was a shot from the hip, and it would be better for miners to run into this concern on testnet than eventually on mainnet. |
Nevermind, I just realized that #1660 was already opened ahead of my comment. |
This aligns the BIP with the Bitcoin Core pull request and sets the allowed delta between the first block of the new difficulty period and the previous block to 7200 seconds (2 hours) instead of 600 seconds.
See also the discussion in the PR: bitcoin/bitcoin#29775 (comment)