aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoss Nicoll <[email protected]>2015-07-27 22:53:06 +0100
committerRoss Nicoll <[email protected]>2015-07-27 23:07:40 +0100
commit5224edba34ddc7e715a4578ad03c17c4490e55be (patch)
treea110955d55e5680b435148206ead1c028113bcc7 /src
parentMerge pull request #1201 from rnicoll/1.10-sync (diff)
downloaddiscoin-5224edba34ddc7e715a4578ad03c17c4490e55be.tar.xz
discoin-5224edba34ddc7e715a4578ad03c17c4490e55be.zip
Remove hard coded switch on whether simplified rewards are used.
Diffstat (limited to 'src')
-rw-r--r--src/chainparams.cpp3
-rw-r--r--src/consensus/params.h1
-rw-r--r--src/dogecoin.cpp2
-rw-r--r--src/test/dogecoin_tests.cpp6
4 files changed, 10 insertions, 2 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index a26655585..94bf5b33f 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -45,6 +45,7 @@ public:
consensus.nPowTargetSpacing = 60; // 1 minute
consensus.fPowAllowMinDifficultyBlocks = false;
consensus.fPowAllowDigishieldMinDifficultyBlocks = false;
+ consensus.fSimplifiedRewards = false;
consensus.nAuxpowChainId = 0x0062; // 98 - Josh Wise!
consensus.fStrictChainId = true;
consensus.fAllowLegacyBlocks = true;
@@ -54,6 +55,7 @@ public:
// Blocks 145000 - 371336 are Digishield without AuxPoW
digishieldConsensus = consensus;
digishieldConsensus.nHeightEffective = 145000;
+ digishieldConsensus.fSimplifiedRewards = true;
digishieldConsensus.fDigishieldDifficultyCalculation = true;
digishieldConsensus.nPowTargetTimespan = 60; // post-digishield: 1 minute
@@ -199,6 +201,7 @@ public:
digishieldConsensus.nHeightEffective = 145000;
digishieldConsensus.nPowTargetTimespan = 60; // post-digishield: 1 minute
digishieldConsensus.fDigishieldDifficultyCalculation = true;
+ digishieldConsensus.fSimplifiedRewards = true;
digishieldConsensus.fPowAllowMinDifficultyBlocks = false;
// Blocks 157500 - 158099 are Digishield with minimum difficulty on all blocks
diff --git a/src/consensus/params.h b/src/consensus/params.h
index f0fdae660..906599ff4 100644
--- a/src/consensus/params.h
+++ b/src/consensus/params.h
@@ -29,6 +29,7 @@ struct Params {
/** Dogecoin-specific parameters */
bool fDigishieldDifficultyCalculation;
bool fPowAllowDigishieldMinDifficultyBlocks; // Allow minimum difficulty blocks where a retarget would normally occur
+ bool fSimplifiedRewards;
/** Auxpow parameters */
int16_t nAuxpowChainId;
diff --git a/src/dogecoin.cpp b/src/dogecoin.cpp
index 6916982e0..53873cc92 100644
--- a/src/dogecoin.cpp
+++ b/src/dogecoin.cpp
@@ -131,7 +131,7 @@ CAmount GetDogecoinBlockSubsidy(int nHeight, const Consensus::Params& consensusP
{
int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
- if (nHeight < 145000) // && !consensusParams.SimplifiedRewards())
+ if (!consensusParams.fSimplifiedRewards)
{
// Old-style rewards derived from the previous block hash
const std::string cseed_str = prevHash.ToString().substr(7, 7);
diff --git a/src/test/dogecoin_tests.cpp b/src/test/dogecoin_tests.cpp
index 7185b377a..efa4e9207 100644
--- a/src/test/dogecoin_tests.cpp
+++ b/src/test/dogecoin_tests.cpp
@@ -63,23 +63,26 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test)
{
int nHeight = 0;
int nStepSize= 1;
- const Consensus::Params& params = Params(CBaseChainParams::MAIN).GetConsensus(0);
CAmount nSum = 0;
uint256 prevHash = uint256S("0");
+ const CChainParams mainParams = Params(CBaseChainParams::MAIN);
for (nHeight = 0; nHeight <= 100000; nHeight++) {
+ const Consensus::Params& params = mainParams.GetConsensus(nHeight);
CAmount nSubsidy = GetDogecoinBlockSubsidy(nHeight, params, prevHash);
BOOST_CHECK(MoneyRange(nSubsidy));
BOOST_CHECK(nSubsidy <= 1000000 * COIN);
nSum += nSubsidy * nStepSize;
}
for (; nHeight <= 145000; nHeight++) {
+ const Consensus::Params& params = mainParams.GetConsensus(nHeight);
CAmount nSubsidy = GetDogecoinBlockSubsidy(nHeight, params, prevHash);
BOOST_CHECK(MoneyRange(nSubsidy));
BOOST_CHECK(nSubsidy <= 500000 * COIN);
nSum += nSubsidy * nStepSize;
}
for (; nHeight < 600000; nHeight++) {
+ const Consensus::Params& params = mainParams.GetConsensus(nHeight);
CAmount nSubsidy = GetDogecoinBlockSubsidy(nHeight, params, prevHash);
CAmount nExpectedSubsidy = (500000 >> (nHeight / 100000)) * COIN;
BOOST_CHECK(MoneyRange(nSubsidy));
@@ -95,6 +98,7 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test)
BOOST_CHECK(nSum >= lowerlimit);
// Test reward at 600k+ is constant
+ const Consensus::Params& params = mainParams.GetConsensus(600000);
CAmount nConstantSubsidy = GetDogecoinBlockSubsidy(600000, params, prevHash);
BOOST_CHECK_EQUAL(nConstantSubsidy, 10000 * COIN);