Repository navigation
consensus: make difficulty retarget windows contiguous (timewarp hardfork) - #442
Draft
kwsantiago wants to merge 4 commits into
Draft
kwsantiago wants to merge 4 commits into
kwsantiago wants to merge 4 commits into
Conversation
kwsantiago
force-pushed
the
hf-timewarp
branch
from
October 9, 2026 19:46
96e22f3 to
d653df0
Compare
kwsantiago
force-pushed
the
hf-timewarp
branch
from
October 9, 2026 20:21
d653df0 to
0bba5c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft, for review. No activation height is set on any network, so this is inert as it stands.
The retarget at
Rmeasurestime(R-1) - time(R-2016): 2016 blocks, 2015 intervals. The interval betweenR-1andRis measured by nothing, and that gap is what the timewarp attack spends.Two rules, on a new unscheduled buried deployment:
Rmeasurestime(R-1) - time(R-2017), so consecutive windows share an endpointtime(H) >= time(H-2016)Both are needed. Contiguous windows alone leave the Murch-Zawy residual: a negative span is credited as
nPowTargetTimespan/4, and that 4x rise pays for two 4x drops. Alone, the schedule reaches 0.0156x of starting difficulty over 31 seconds of chain time; with both, 336 days.The floor is BIP-54's non-negative-duration rule re-anchored to the corrected window. BIP-54's other rule becomes unnecessary, which drops its 7200s grace.
Enforced in
ContextualCheckBlockHeaderVolatilesoConnectBlockre-runs it, and re-derived at startup byFindInheritedInvalidBlocks, as the BLAKE2b fork already does.Hardfork: old nodes compute different
nBitsand split at activation.