diff options
| author | Patrick Lodder <[email protected]> | 2015-08-07 15:57:51 +0200 |
|---|---|---|
| committer | Ross Nicoll <[email protected]> | 2015-10-18 13:28:59 +0000 |
| commit | 320234c0e5d594f9205c4780fff33a10590d21f4 (patch) | |
| tree | 64de7a7873e0a5f1809c443cabc4689db2b1ae40 /src | |
| parent | enable CBlockIndex::IsSuperMajority (diff) | |
| download | discoin-320234c0e5d594f9205c4780fff33a10590d21f4.tar.xz discoin-320234c0e5d594f9205c4780fff33a10590d21f4.zip | |
Reject version 1 blocks with version 3 supermajority
Because CBlockIndex::IsSuperMajority was disabled since 1.5, we cannot
enforce version 1 block rejection on the live chains with a v2 supermajority.
Instead, we piggyback the version 3 supermajority switch to also enforce the
version 2 softfork and all is good.
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index d9810842b..f34b037d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2713,10 +2713,12 @@ bool AcceptBlockHeader(CBlockHeader& block, CValidationState& state, CBlockIndex return state.DoS(100, error("AcceptBlock() : forked chain older than last checkpoint (height %d)", nHeight)); // Reject block.nVersion=1 blocks when 95% (75% on testnet) of the network has upgraded: + // Dogecoin: reject ONLY if block.nVersion=3 has a supermajority because CBlockIndex::IsSuperMajority + // was hard-disabled until now if (block.GetBaseVersion() < 2) { - if ((!TestNet() && CBlockIndex::IsSuperMajority(2, pindexPrev, 950, 1000)) || - (TestNet() && CBlockIndex::IsSuperMajority(2, pindexPrev, 75, 100))) + if ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindexPrev, 950, 1000)) || + (TestNet() && CBlockIndex::IsSuperMajority(3, pindexPrev, 75, 100))) { return state.Invalid(error("AcceptBlock() : rejected nVersion=1 block"), REJECT_OBSOLETE, "bad-version"); @@ -2772,11 +2774,13 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** ppindex, } } // Enforce block.nVersion=2 rule that the coinbase starts with serialized block height + // Dogecoin: reject ONLY if block.nVersion=3 has a supermajority because CBlockIndex::IsSuperMajority + // was hard-disabled until now if (block.GetBaseVersion() >= 2) { // if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet): - if ((!TestNet() && CBlockIndex::IsSuperMajority(2, pindex->pprev, 750, 1000)) || - (TestNet() && CBlockIndex::IsSuperMajority(2, pindex->pprev, 51, 100))) + if ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 750, 1000)) || + (TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 51, 100))) { CScript expect = CScript() << nHeight; if (block.vtx[0].vin[0].scriptSig.size() < expect.size() || |