aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPatrick Lodder <[email protected]>2015-08-10 10:31:17 +0200
committerPatrick Lodder <[email protected]>2015-08-10 10:54:28 +0200
commit2d332d242a334b0ee9191ca5d1a1bb7f2415066f (patch)
tree88e1729815602ae283fcb6c2b8ad0051c016c257 /src/main.cpp
parentMerge pull request #1227 from kaykurokawa/1.10-dev (diff)
downloaddiscoin-2d332d242a334b0ee9191ca5d1a1bb7f2415066f.tar.xz
discoin-2d332d242a334b0ee9191ca5d1a1bb7f2415066f.zip
Re-enable SuperMajority triggered activation for v2 block constraints
Start validating v2 blocks when there is a v3 supermajority, because v2 clients (1.5->1.8) had supermajority checks disabled. This is needed for future-proofing, so that a currently accepted, but invalid v2 block will also be accepted on newer nodes.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a3d5dcc30..d36f4ab6e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2793,7 +2793,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
}
// Reject block.nVersion=1 blocks when 95% (75% on testnet) of the network has upgraded:
- // Dogecoin: Version 2 enforcement was never used
+ // Dogecoin: Version 2 enforcement was never used, reject from v3 softfork
//if (block.nVersion < 2 && IsSuperMajority(2, pindexPrev, consensusParams.nMajorityRejectBlockOutdated, consensusParams))
// return state.Invalid(error("%s: rejected nVersion=1 block", __func__),
// REJECT_OBSOLETE, "bad-version");
@@ -2810,6 +2810,9 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
{
const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1;
+ const CChainParams& chainParams = Params();
+ const Consensus::Params& consensusParams = chainParams.GetConsensus(nHeight);
+
// Check that all transactions are finalized
BOOST_FOREACH(const CTransaction& tx, block.vtx)
if (!IsFinalTx(tx, nHeight, block.GetBlockTime())) {
@@ -2818,8 +2821,8 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
// Enforce block.nVersion=2 rule that the coinbase starts with serialized block height
// if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet):
- // Dogecoin: Block v2 was never enforced
- if (block.nVersion >= 3)
+ // Dogecoin: Block v2 was never enforced, so we trigger this against v3
+ if (block.nVersion >= 2 && IsSuperMajority(3, pindexPrev, consensusParams.nMajorityEnforceBlockUpgrade, consensusParams))
{
CScript expect = CScript() << nHeight;
if (block.vtx[0].vin[0].scriptSig.size() < expect.size() ||