aboutsummaryrefslogtreecommitdiff
path: root/src/chainparams.cpp
diff options
context:
space:
mode:
authorPatrick Lodder <[email protected]>2015-07-20 15:03:02 +0200
committerPatrick Lodder <[email protected]>2015-07-20 15:03:02 +0200
commit8cd835cddba565594f5cde2d91ee92e32bcbf2fd (patch)
tree049698b334daf7e65af268b0da64134fd9dbbfdc /src/chainparams.cpp
parentMerge pull request #1200 from rnicoll/1.10-auxpow-clean (diff)
parentUpdate Python test address and key values to match Dogecoin format. (diff)
downloaddiscoin-8cd835cddba565594f5cde2d91ee92e32bcbf2fd.tar.xz
discoin-8cd835cddba565594f5cde2d91ee92e32bcbf2fd.zip
Merge pull request #1201 from rnicoll/1.10-sync
Consensus fixes
Diffstat (limited to 'src/chainparams.cpp')
-rw-r--r--src/chainparams.cpp99
1 files changed, 93 insertions, 6 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index 8a5e613c7..a26655585 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -28,9 +28,14 @@ using namespace std;
*/
class CMainParams : public CChainParams {
+protected:
+ Consensus::Params digishieldConsensus;
+ Consensus::Params auxpowConsensus;
public:
CMainParams() {
strNetworkID = "main";
+
+ // Blocks 0 - 144999 are conventional difficulty calculation
consensus.nSubsidyHalvingInterval = 100000;
consensus.nMajorityEnforceBlockUpgrade = 750;
consensus.nMajorityRejectBlockOutdated = 950;
@@ -39,10 +44,29 @@ public:
consensus.nPowTargetTimespan = 4 * 60 * 60; // pre-digishield: 4 hours
consensus.nPowTargetSpacing = 60; // 1 minute
consensus.fPowAllowMinDifficultyBlocks = false;
+ consensus.fPowAllowDigishieldMinDifficultyBlocks = false;
consensus.nAuxpowChainId = 0x0062; // 98 - Josh Wise!
- consensus.nAuxpowStartHeight = 371337;
consensus.fStrictChainId = true;
- consensus.nLegacyBlocksBefore = 371337;
+ consensus.fAllowLegacyBlocks = true;
+ consensus.nHeightEffective = 0;
+ consensus.fDigishieldDifficultyCalculation = false;
+
+ // Blocks 145000 - 371336 are Digishield without AuxPoW
+ digishieldConsensus = consensus;
+ digishieldConsensus.nHeightEffective = 145000;
+ digishieldConsensus.fDigishieldDifficultyCalculation = true;
+ digishieldConsensus.nPowTargetTimespan = 60; // post-digishield: 1 minute
+
+ // Blocks 371337+ are AuxPoW
+ auxpowConsensus = digishieldConsensus;
+ auxpowConsensus.nHeightEffective = 371337;
+ auxpowConsensus.fAllowLegacyBlocks = false;
+
+ // Assemble the binary search tree of consensus parameters
+ pConsensusRoot = &digishieldConsensus;
+ digishieldConsensus.pLeft = &consensus;
+ digishieldConsensus.pRight = &auxpowConsensus;
+
/**
* The message start string is designed to be unlikely to occur in normal data.
* The characters are rarely used upper ASCII, not valid as UTF-8, and produce
@@ -84,6 +108,8 @@ public:
genesis.nNonce = 99943;
consensus.hashGenesisBlock = genesis.GetHash();
+ digishieldConsensus.hashGenesisBlock = consensus.hashGenesisBlock;
+ auxpowConsensus.hashGenesisBlock = consensus.hashGenesisBlock;
assert(consensus.hashGenesisBlock == uint256S("0x1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691"));
assert(genesis.hashMerkleRoot == uint256S("0x5b2a3f53f605d62c53e62932dac6925e3d74afa5a4b459745c36d42d0ed26a69"));
@@ -145,16 +171,53 @@ static CMainParams mainParams;
* Testnet (v3)
*/
class CTestNetParams : public CMainParams {
+private:
+ Consensus::Params minDifficultyConsensus;
public:
CTestNetParams() {
strNetworkID = "test";
+
+ // Blocks 0 - 144999 are pre-Digishield
+ consensus.nHeightEffective = 0;
+ consensus.nPowTargetTimespan = 4 * 60 * 60; // pre-digishield: 4 hours
+ consensus.fDigishieldDifficultyCalculation = false;
+ consensus.fPowAllowMinDifficultyBlocks = true;
+ consensus.fPowAllowDigishieldMinDifficultyBlocks = false;
consensus.nMajorityEnforceBlockUpgrade = 51;
consensus.nMajorityRejectBlockOutdated = 75;
consensus.nMajorityWindow = 100;
- consensus.fPowAllowMinDifficultyBlocks = true;
- consensus.nAuxpowStartHeight = 158100;
consensus.fStrictChainId = false;
- consensus.nLegacyBlocksBefore = 158100;
+ consensus.nHeightEffective = 0;
+ consensus.fAllowLegacyBlocks = true;
+
+ // Reset links before we copy parameters
+ consensus.pLeft = NULL;
+ consensus.pRight = NULL;
+
+ // Blocks 145000 - 157499 are Digishield without minimum difficulty on all blocks
+ digishieldConsensus = consensus;
+ digishieldConsensus.nHeightEffective = 145000;
+ digishieldConsensus.nPowTargetTimespan = 60; // post-digishield: 1 minute
+ digishieldConsensus.fDigishieldDifficultyCalculation = true;
+ digishieldConsensus.fPowAllowMinDifficultyBlocks = false;
+
+ // Blocks 157500 - 158099 are Digishield with minimum difficulty on all blocks
+ minDifficultyConsensus = digishieldConsensus;
+ minDifficultyConsensus.nHeightEffective = 157500;
+ minDifficultyConsensus.fPowAllowDigishieldMinDifficultyBlocks = true;
+ minDifficultyConsensus.fPowAllowMinDifficultyBlocks = true;
+
+ // Enable AuxPoW at 158100
+ auxpowConsensus = minDifficultyConsensus;
+ auxpowConsensus.nHeightEffective = 158100;
+ auxpowConsensus.fPowAllowDigishieldMinDifficultyBlocks = true;
+ auxpowConsensus.fAllowLegacyBlocks = false;
+
+ // Assemble the binary search tree of parameters
+ pConsensusRoot = &digishieldConsensus;
+ digishieldConsensus.pLeft = &consensus;
+ digishieldConsensus.pRight = &minDifficultyConsensus;
+ minDifficultyConsensus.pRight = &auxpowConsensus;
pchMessageStart[0] = 0xfc;
pchMessageStart[1] = 0xc1;
@@ -169,6 +232,9 @@ public:
genesis.nTime = 1391503289;
genesis.nNonce = 997879;
consensus.hashGenesisBlock = genesis.GetHash();
+ digishieldConsensus.hashGenesisBlock = consensus.hashGenesisBlock;
+ minDifficultyConsensus.hashGenesisBlock = consensus.hashGenesisBlock;
+ auxpowConsensus.hashGenesisBlock = consensus.hashGenesisBlock;
assert(consensus.hashGenesisBlock == uint256S("0xbb0a78264637406b6360aad926284d544d7049f45189db5664f3c4d07350559e"));
vFixedSeeds.clear();
@@ -215,9 +281,28 @@ public:
consensus.nMajorityEnforceBlockUpgrade = 750;
consensus.nMajorityRejectBlockOutdated = 950;
consensus.nMajorityWindow = 1000;
+ consensus.nPowTargetTimespan = 4 * 60 * 60; // pre-digishield: 4 hours
consensus.powLimit = uint256S("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1;
consensus.fStrictChainId = true;
- consensus.nLegacyBlocksBefore = 0;
+ consensus.fAllowLegacyBlocks = false; // Never allow legacy blocks on RegTest
+
+ // Reset links before we copy parameters
+ consensus.pLeft = NULL;
+ consensus.pRight = NULL;
+
+ digishieldConsensus = consensus;
+ digishieldConsensus.nHeightEffective = 10;
+ digishieldConsensus.nPowTargetTimespan = 60; // post-digishield: 1 minute
+ digishieldConsensus.fDigishieldDifficultyCalculation = true;
+
+ auxpowConsensus = digishieldConsensus;
+ auxpowConsensus.nHeightEffective = 20;
+
+ // Assemble the binary search tree of parameters
+ digishieldConsensus.pLeft = &consensus;
+ digishieldConsensus.pRight = &auxpowConsensus;
+ pConsensusRoot = &digishieldConsensus;
+
pchMessageStart[0] = 0xfa;
pchMessageStart[1] = 0xbf;
pchMessageStart[2] = 0xb5;
@@ -227,6 +312,8 @@ public:
genesis.nBits = 0x207fffff;
genesis.nNonce = 2;
consensus.hashGenesisBlock = genesis.GetHash();
+ digishieldConsensus.hashGenesisBlock = consensus.hashGenesisBlock;
+ auxpowConsensus.hashGenesisBlock = consensus.hashGenesisBlock;
nDefaultPort = 18444;
assert(consensus.hashGenesisBlock == uint256S("0x3d2160a3b5dc4a9d62e7e66a295f70313ac808440ef7400d6c0772171ce973a5"));
nPruneAfterHeight = 1000;