aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
diff options
context:
space:
mode:
authorRoss Nicoll <[email protected]>2017-12-27 21:11:14 +0000
committerRoss Nicoll <[email protected]>2018-09-19 19:23:29 +0100
commita89d54c4b228c02a62e21039f318f5225aad2cf9 (patch)
tree115470cc09b4174ddcd3d48a251a1d8d7f2da548 /src/rpc/blockchain.cpp
parentSet SegWit timeout to zero to disable it (#1405) (diff)
downloaddiscoin-a89d54c4b228c02a62e21039f318f5225aad2cf9.tar.xz
discoin-a89d54c4b228c02a62e21039f318f5225aad2cf9.zip
Change BIP65/66 enforcement to match Dogecoin (#1403)
* Introduce first estimates at BIP lock-in blocks * Introduce Dogecoin BIP parameters * Re-introduce supermajority rules for BIP65 * Add BIP65 supermajority rules * Tighten v3 block constraints * Don't enforce coinbase in v2 blocks * Correct testnet majority params * Change to using base version when checking supermajority
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r--src/rpc/blockchain.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 92601a5ec..d06c00cbc 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1071,7 +1071,20 @@ static UniValue SoftForkMajorityDesc(int version, CBlockIndex* pindex, const Con
activated = pindex->nHeight >= consensusParams.BIP66Height;
break;
case 4:
- activated = pindex->nHeight >= consensusParams.BIP65Height;
+ int nFound = 0;
+ int nRequired = consensusParams.nMajorityRejectBlockOutdated;
+ CBlockIndex* pstart = pindex;
+ for (int i = 0; i < consensusParams.nMajorityWindow && pstart != NULL; i++)
+ {
+ if (pstart->nVersion >= version)
+ ++nFound;
+ pstart = pstart->pprev;
+ }
+
+ activated = nFound >= nRequired;
+ rv.push_back(Pair("found", nFound));
+ rv.push_back(Pair("required", nRequired));
+ rv.push_back(Pair("window", consensusParams.nMajorityWindow));
break;
}
rv.push_back(Pair("status", activated));