Skip to content

Commit 0aa8c3a

Browse files
authored
Merge pull request bitcoin#1021 from ajtowns/202010-bip8-mustsignal-to-threshold
BIP8: allow some MUST_SIGNAL blocks to not signal
2 parents 79cd91e + afe97b2 commit 0aa8c3a

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

bip-0008.mediawiki

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Miners should continue setting the bit in LOCKED_IN phase so uptake is visible,
8585

8686
The new consensus rules for each soft fork are enforced for each block that has ACTIVE state.
8787

88-
During the MUST_SIGNAL phase, blocks that fail to signal are invalid.
88+
During the MUST_SIGNAL phase, if '''(2016 - threshold)''' blocks in the retarget period have already failed to signal, any further blocks that fail to signal are invalid.
8989

9090
===State transitions===
9191

@@ -177,11 +177,23 @@ block, indexed by its parent.
177177

178178
===Mandatory signalling===
179179

180-
Blocks received while in the MUST_SIGNAL phase must be checked to ensure that they signal. For example:
180+
Blocks received while in the MUST_SIGNAL phase must be checked to ensure that they signal as required. For example:
181181

182182
if (GetStateForBlock(block) == MUST_SIGNAL) {
183-
if ((block.nVersion & 0xE0000000) != 0x20000000 || ((block.nVersion >> bit) & 1) != 1) {
184-
return state.Invalid(BlockValidationResult::RECENT_CONSENSUS_CHANGE, "bad-version-bip8-must-signal");
183+
int nonsignal = 0;
184+
int count = 1 + (block.nHeight % 2016);
185+
walk = block;
186+
while (count > 0) {
187+
--count;
188+
if ((walk.nVersion & 0xE0000000) != 0x20000000 || ((walk.nVersion >> bit) & 1) != 1) {
189+
++nonsignal;
190+
if (nonsignal + threshold > 2016) {
191+
return state.Invalid(BlockValidationResult::RECENT_CONSENSUS_CHANGE, "bad-version-bip8-must-signal");
192+
}
193+
} else if (nonsignal == 0) {
194+
break;
195+
}
196+
walk = walk.parent;
185197
}
186198
}
187199

0 commit comments

Comments
 (0)