Skip to content

Commit afe97b2

Browse files
committed
BIP8: allow some MUST_SIGNAL blocks to not signal
Using the same threshold for MUST_SIGNAL as STARTED means that any chain that would have resulted in activation with lockinontimeout=false will also result in activation with lockinontimeout=true (and vice-versa). This reduces the ways in which a consensus split can occur, and avoids a way in which miners could attempt to discourage users from setting lockinontimeout=true.
1 parent 9a119ce commit afe97b2

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
@@ -83,7 +83,7 @@ Miners should continue setting the bit in LOCKED_IN phase so uptake is visible,
8383

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

86-
During the MUST_SIGNAL phase, blocks that fail to signal are invalid.
86+
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.
8787

8888
===State transitions===
8989

@@ -175,11 +175,23 @@ block, indexed by its parent.
175175

176176
===Mandatory signalling===
177177

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

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

0 commit comments

Comments
 (0)