1
0
mirror of https://github.com/bitcoin/bips.git synced 2025-05-12 12:03:29 +00:00

Merge pull request #388 from stevenroose/patch-2

Error in BIP0009 code example
This commit is contained in:
Luke-Jr 2016-05-18 22:47:14 +00:00
commit 9a995e6879

View File

@ -112,7 +112,7 @@ other one simultaneously transitions to STARTED, which would mean both would dem
Note that a block's state never depends on its own nVersion; only on that of its ancestors.
case STARTED: {
case STARTED:
if (GetMedianTimePast(block.parent) >= timeout) {
return FAILED;
}
@ -120,14 +120,14 @@ Note that a block's state never depends on its own nVersion; only on that of its
walk = block;
for (i = 0; i < 2016; i++) {
walk = walk.parent;
if (walk.nVersion & 0xE0000000 == 0x2000000 && (walk.nVersion >> bit) & 1 == 1) {
if (walk.nVersion & 0xE0000000 == 0x20000000 && (walk.nVersion >> bit) & 1 == 1) {
count++;
}
}
if (count >= threshold) {
return LOCKED_IN;
}
}
return STARTED;
After a retarget period of LOCKED_IN, we automatically transition to ACTIVE.