summaryrefslogtreecommitdiff
path: root/bip-0008.mediawiki
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2021-02-04 12:25:25 +1000
committerAnthony Towns <aj@erisian.com.au>2021-02-04 12:51:11 +1000
commit63d2800fabe4393382f699ba1e41260ab7b01727 (patch)
treefeb81340aa3ba211d131224dca52ce00e556509e /bip-0008.mediawiki
parent518fd3fe07dd66f35c3c215098c2eb7183de0486 (diff)
downloadbips-63d2800fabe4393382f699ba1e41260ab7b01727.tar.xz
bip 8: simplify MUST_SIGNAL check
Diffstat (limited to 'bip-0008.mediawiki')
-rw-r--r--bip-0008.mediawiki10
1 files changed, 5 insertions, 5 deletions
diff --git a/bip-0008.mediawiki b/bip-0008.mediawiki
index d5cb191..8800b43 100644
--- a/bip-0008.mediawiki
+++ b/bip-0008.mediawiki
@@ -181,16 +181,16 @@ Blocks received while in the MUST_SIGNAL phase must be checked to ensure that th
if (GetStateForBlock(block) == MUST_SIGNAL) {
int nonsignal = 0;
- int count = 1 + (block.nHeight % 2016);
walk = block;
- while (count > 0) {
- --count;
+ while (true) {
if ((walk.nVersion & 0xE0000000) != 0x20000000 || ((walk.nVersion >> bit) & 1) != 1) {
++nonsignal;
- if (nonsignal + threshold > 2016) {
+ if (nonsignal > 2016 - threshold) {
return state.Invalid(BlockValidationResult::RECENT_CONSENSUS_CHANGE, "bad-version-bip8-must-signal");
}
- } else if (nonsignal == 0) {
+ }
+ if (walk.nHeight % 2016 == 0) {
+ // checked every block in this retarget period
break;
}
walk = walk.parent;