aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax K. <[email protected]>2015-08-26 21:54:10 +0200
committerMax K. <[email protected]>2015-08-26 21:54:10 +0200
commit442c82da4adbf4573289e65109a5f789f2d29cf3 (patch)
tree18d4968b9a6d80f32f7a2c4f0cf201c128913b9c /src
parentMerge pull request #1264 from patricklodder/1.10-auxrpc-no-bip22 (diff)
parentfix rest.py test: cannot mine an auxpow block at height 1 (diff)
downloaddiscoin-442c82da4adbf4573289e65109a5f789f2d29cf3.tar.xz
discoin-442c82da4adbf4573289e65109a5f789f2d29cf3.zip
Merge pull request #1267 from patricklodder/1.10-strict-auxpow
[auxpow] Check for auxpow fork strictly
Diffstat (limited to 'src')
-rw-r--r--src/chainparams.cpp9
-rw-r--r--src/consensus/params.h1
-rw-r--r--src/main.cpp7
3 files changed, 16 insertions, 1 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index bb0350b11..8ce5318d0 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -50,6 +50,7 @@ public:
consensus.nAuxpowChainId = 0x0062; // 98 - Josh Wise!
consensus.fStrictChainId = true;
consensus.fAllowLegacyBlocks = true;
+ consensus.fAllowAuxPow = false;
consensus.nHeightEffective = 0;
consensus.fDigishieldDifficultyCalculation = false;
consensus.nCoinbaseMaturity = 30;
@@ -66,6 +67,7 @@ public:
auxpowConsensus = digishieldConsensus;
auxpowConsensus.nHeightEffective = 371337;
auxpowConsensus.fAllowLegacyBlocks = false;
+ auxpowConsensus.fAllowAuxPow = true;
// Assemble the binary search tree of consensus parameters
pConsensusRoot = &digishieldConsensus;
@@ -188,6 +190,7 @@ public:
consensus.fStrictChainId = false;
consensus.nHeightEffective = 0;
consensus.fAllowLegacyBlocks = true;
+ consensus.fAllowAuxPow = false;
// Reset links before we copy parameters
consensus.pLeft = NULL;
@@ -213,6 +216,7 @@ public:
auxpowConsensus.nHeightEffective = 158100;
auxpowConsensus.fPowAllowDigishieldMinDifficultyBlocks = true;
auxpowConsensus.fAllowLegacyBlocks = false;
+ auxpowConsensus.fAllowAuxPow = true;
// Assemble the binary search tree of parameters
pConsensusRoot = &digishieldConsensus;
@@ -286,7 +290,8 @@ public:
consensus.nPowTargetSpacing = 1; // regtest: 1 second blocks
consensus.powLimit = uint256S("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1;
consensus.fStrictChainId = true;
- consensus.fAllowLegacyBlocks = false; // Never allow legacy blocks on RegTest
+ consensus.fAllowLegacyBlocks = true;
+ consensus.fAllowAuxPow = false;
consensus.fSimplifiedRewards = true;
consensus.nCoinbaseMaturity = 60; // For easier testability in RPC tests
@@ -300,6 +305,8 @@ public:
digishieldConsensus.fDigishieldDifficultyCalculation = true;
auxpowConsensus = digishieldConsensus;
+ auxpowConsensus.fAllowLegacyBlocks = false;
+ auxpowConsensus.fAllowAuxPow = true;
auxpowConsensus.nHeightEffective = 20;
// Assemble the binary search tree of parameters
diff --git a/src/consensus/params.h b/src/consensus/params.h
index 74e49f3a4..89969707b 100644
--- a/src/consensus/params.h
+++ b/src/consensus/params.h
@@ -35,6 +35,7 @@ struct Params {
/** Auxpow parameters */
int16_t nAuxpowChainId;
+ bool fAllowAuxPow;
bool fStrictChainId;
bool fAllowLegacyBlocks;
diff --git a/src/main.cpp b/src/main.cpp
index 5fffaa381..070b27832 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2768,6 +2768,13 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
__func__, pindexPrev->nHeight + 1, consensusParams.nHeightEffective),
REJECT_INVALID, "late-legacy-block");
+ // Disallow AuxPow blocks before it is activated.
+ if (!consensusParams.fAllowAuxPow
+ && block.nVersion.IsAuxpow())
+ return state.DoS(100, error("%s : auxpow blocks are not allowed at height %d, parameters effective from %d",
+ __func__, pindexPrev->nHeight + 1, consensusParams.nHeightEffective),
+ REJECT_INVALID, "early-auxpow-block");
+
// Check proof of work
if (block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams))
return state.DoS(100, error("%s: incorrect proof of work at height %d", __func__, nHeight),