diff --git a/src/pow.cpp b/src/pow.cpp index 1b5a87890..ebcba1dae 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -71,8 +71,8 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF arith_uint256 bnOld; bnNew.SetCompact(pindexLast->nBits); bnOld = bnNew; - bnNew *= nActualTimespan; bnNew /= params.nPowTargetTimespan; + bnNew *= nActualTimespan; if (bnNew > bnPowLimit) bnNew = bnPowLimit; diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp index a43674928..8e244f1ee 100644 --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -37,8 +37,9 @@ BOOST_AUTO_TEST_CASE(get_next_work_pow_limit) CBlockIndex pindexLast; pindexLast.nHeight = 2015; pindexLast.nTime = 1233061996; // Block #2015 - pindexLast.nBits = 0x1d00ffff; - BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00ffff); + // TODO change once the harder genesis block is generated + pindexLast.nBits = 0x207fffff; + BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x207fffff); } /* Test the constraint on the lower bound for actual time taken */ @@ -52,7 +53,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual) pindexLast.nHeight = 68543; pindexLast.nTime = 1279297671; // Block #68543 pindexLast.nBits = 0x1c05a3f4; - BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0168fd); + BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0168fc); } /* Test the constraint on the upper bound for actual time taken */