aboutsummaryrefslogtreecommitdiff
path: root/src/test/pow_tests.cpp
diff options
context:
space:
mode:
authorRoss Nicoll <[email protected]>2018-09-19 15:58:29 +0100
committerRoss Nicoll <[email protected]>2018-09-23 21:22:58 +0100
commit199cf694ef955137f87138f78b9c0f010dcc90b6 (patch)
tree46d2e44b82eca63a6e6c7a13ad7dbe2f1ca5bc82 /src/test/pow_tests.cpp
parentCreate v1 transactions for compatibility with 1.10 (#1485) (diff)
downloaddiscoin-199cf694ef955137f87138f78b9c0f010dcc90b6.tar.xz
discoin-199cf694ef955137f87138f78b9c0f010dcc90b6.zip
Update miner confirmation window
* Update miner confirmation window to 240 for Dogecoin main net, and update related values. * Re-enable PoW tests with Dogecoin values. * Update version bit tests based on Dogecoin mining values.
Diffstat (limited to 'src/test/pow_tests.cpp')
-rw-r--r--src/test/pow_tests.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp
index a90e6896b..e112c7339 100644
--- a/src/test/pow_tests.cpp
+++ b/src/test/pow_tests.cpp
@@ -14,23 +14,21 @@
BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup)
/* Test calculation of next difficulty target with no constraints applying */
-// Replaced by Dogecoin-specific PoW test
-/* BOOST_AUTO_TEST_CASE(get_next_work)
+BOOST_AUTO_TEST_CASE(get_next_work)
{
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus(0);
- int64_t nLastRetargetTime = 1261130161; // Block #30240
+ int64_t nLastRetargetTime = 1388149872; // Block #30240
CBlockIndex pindexLast;
- pindexLast.nHeight = 32255;
- pindexLast.nTime = 1262152739; // Block #32255
- pindexLast.nBits = 0x1d00ffff;
- BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00d86a);
-} */
+ pindexLast.nHeight = 30479;
+ pindexLast.nTime = 1388163922; // Block #30479
+ pindexLast.nBits = 0x1c00974f;
+ BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0093a1);
+}
/* Test the constraint on the upper bound for next work */
-// Replaced by Dogecoin-specific PoW test
-/* BOOST_AUTO_TEST_CASE(get_next_work_pow_limit)
+BOOST_AUTO_TEST_CASE(get_next_work_pow_limit)
{
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus(0);
@@ -40,23 +38,22 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup)
pindexLast.nHeight = 2015;
pindexLast.nTime = 1233061996; // Block #2015
pindexLast.nBits = 0x1d00ffff;
- BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00ffff);
-} */
+ BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d03fffc);
+}
/* Test the constraint on the lower bound for actual time taken */
-// Replaced by Dogecoin-specific PoW test
-/* BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual)
+BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual)
{
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus(0);
int64_t nLastRetargetTime = 1279008237; // Block #66528
CBlockIndex pindexLast;
- pindexLast.nHeight = 68543;
- pindexLast.nTime = 1279297671; // Block #68543
+ pindexLast.nHeight = 66767;
+ pindexLast.nTime = 1279008237 + (239 * 60 / 4 - 1); // Bitcoin Block #66528 + less than a quarter of the target timespan
pindexLast.nBits = 0x1c05a3f4;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0168fd);
-} */
+}
/* Test the constraint on the upper bound for actual time taken */
// Replaced by Dogecoin-specific PoW test