aboutsummaryrefslogtreecommitdiff
path: root/src/test/dogecoin_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/dogecoin_tests.cpp')
-rw-r--r--src/test/dogecoin_tests.cpp50
1 files changed, 43 insertions, 7 deletions
diff --git a/src/test/dogecoin_tests.cpp b/src/test/dogecoin_tests.cpp
index 4a8d08089..7185b377a 100644
--- a/src/test/dogecoin_tests.cpp
+++ b/src/test/dogecoin_tests.cpp
@@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test)
{
int nHeight = 0;
int nStepSize= 1;
- const Consensus::Params& params = Params(CBaseChainParams::MAIN).GetConsensus();
+ const Consensus::Params& params = Params(CBaseChainParams::MAIN).GetConsensus(0);
CAmount nSum = 0;
uint256 prevHash = uint256S("0");
@@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test)
BOOST_AUTO_TEST_CASE(get_next_work_difficulty_limit)
{
SelectParams(CBaseChainParams::MAIN);
- const Consensus::Params& params = Params().GetConsensus();
+ const Consensus::Params& params = Params().GetConsensus(0);
CBlockIndex pindexLast;
int64_t nLastRetargetTime = 1386474927; // Block # 1
@@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_difficulty_limit)
BOOST_AUTO_TEST_CASE(get_next_work_pre_digishield)
{
SelectParams(CBaseChainParams::MAIN);
- const Consensus::Params& params = Params().GetConsensus();
+ const Consensus::Params& params = Params().GetConsensus(0);
CBlockIndex pindexLast;
int64_t nLastRetargetTime = 1386942008; // Block 9359
@@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_pre_digishield)
BOOST_AUTO_TEST_CASE(get_next_work_digishield)
{
SelectParams(CBaseChainParams::MAIN);
- const Consensus::Params& params = Params().GetConsensus();
+ const Consensus::Params& params = Params().GetConsensus(145000);
CBlockIndex pindexLast;
int64_t nLastRetargetTime = 1395094427;
@@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_digishield)
BOOST_AUTO_TEST_CASE(get_next_work_digishield_modulated_upper)
{
SelectParams(CBaseChainParams::MAIN);
- const Consensus::Params& params = Params().GetConsensus();
+ const Consensus::Params& params = Params().GetConsensus(145000);
CBlockIndex pindexLast;
int64_t nLastRetargetTime = 1395100835;
@@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_digishield_modulated_upper)
BOOST_AUTO_TEST_CASE(get_next_work_digishield_modulated_lower)
{
SelectParams(CBaseChainParams::MAIN);
- const Consensus::Params& params = Params().GetConsensus();
+ const Consensus::Params& params = Params().GetConsensus(145000);
CBlockIndex pindexLast;
int64_t nLastRetargetTime = 1395380517;
@@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_digishield_modulated_lower)
BOOST_AUTO_TEST_CASE(get_next_work_digishield_rounding)
{
SelectParams(CBaseChainParams::MAIN);
- const Consensus::Params& params = Params().GetConsensus();
+ const Consensus::Params& params = Params().GetConsensus(145000);
CBlockIndex pindexLast;
int64_t nLastRetargetTime = 1395094679;
@@ -191,4 +191,40 @@ BOOST_AUTO_TEST_CASE(get_next_work_digishield_rounding)
BOOST_CHECK_EQUAL(CalculateDogecoinNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1b6558a4);
}
+BOOST_AUTO_TEST_CASE(hardfork_parameters)
+{
+ SelectParams(CBaseChainParams::MAIN);
+ const Consensus::Params& initialParams = Params().GetConsensus(0);
+
+ BOOST_CHECK_EQUAL(initialParams.nPowTargetTimespan, 14400);
+ BOOST_CHECK_EQUAL(initialParams.fAllowLegacyBlocks, true);
+ BOOST_CHECK_EQUAL(initialParams.fDigishieldDifficultyCalculation, false);
+
+ const Consensus::Params& initialParamsEnd = Params().GetConsensus(144999);
+ BOOST_CHECK_EQUAL(initialParamsEnd.nPowTargetTimespan, 14400);
+ BOOST_CHECK_EQUAL(initialParamsEnd.fAllowLegacyBlocks, true);
+ BOOST_CHECK_EQUAL(initialParamsEnd.fDigishieldDifficultyCalculation, false);
+
+ const Consensus::Params& digishieldParams = Params().GetConsensus(145000);
+ BOOST_CHECK_EQUAL(digishieldParams.nPowTargetTimespan, 60);
+ BOOST_CHECK_EQUAL(digishieldParams.fAllowLegacyBlocks, true);
+ BOOST_CHECK_EQUAL(digishieldParams.fDigishieldDifficultyCalculation, true);
+
+ const Consensus::Params& digishieldParamsEnd = Params().GetConsensus(371336);
+ BOOST_CHECK_EQUAL(digishieldParamsEnd.nPowTargetTimespan, 60);
+ BOOST_CHECK_EQUAL(digishieldParamsEnd.fAllowLegacyBlocks, true);
+ BOOST_CHECK_EQUAL(digishieldParamsEnd.fDigishieldDifficultyCalculation, true);
+
+ const Consensus::Params& auxpowParams = Params().GetConsensus(371337);
+ BOOST_CHECK_EQUAL(auxpowParams.nHeightEffective, 371337);
+ BOOST_CHECK_EQUAL(auxpowParams.nPowTargetTimespan, 60);
+ BOOST_CHECK_EQUAL(auxpowParams.fAllowLegacyBlocks, false);
+ BOOST_CHECK_EQUAL(auxpowParams.fDigishieldDifficultyCalculation, true);
+
+ const Consensus::Params& auxpowHighParams = Params().GetConsensus(700000); // Arbitrary point after last hard-fork
+ BOOST_CHECK_EQUAL(auxpowHighParams.nPowTargetTimespan, 60);
+ BOOST_CHECK_EQUAL(auxpowHighParams.fAllowLegacyBlocks, false);
+ BOOST_CHECK_EQUAL(auxpowHighParams.fDigishieldDifficultyCalculation, true);
+}
+
BOOST_AUTO_TEST_SUITE_END()