Expand bounds on difficulty adjustment

This commit is contained in:
Jack Grigg
2016-09-06 13:13:23 +12:00
parent cb708a99a5
commit 8f3ec042af
2 changed files with 6 additions and 6 deletions

View File

@@ -50,13 +50,13 @@ BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual)
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus();
int64_t nLastRetargetTime = 1279295950; // NOTE: Not an actual block time
int64_t nLastRetargetTime = 1279296753; // NOTE: Not an actual block time
CBlockIndex pindexLast;
pindexLast.nHeight = 68543;
pindexLast.nTime = 1279297671; // Block #68543 of Bitcoin
// This represents an average difficulty in the current algorithm
pindexLast.nBits = 0x1c05a3f4;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c05306f);
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c04bceb);
}
/* Test the constraint on the upper bound for actual time taken */
@@ -65,13 +65,13 @@ BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual)
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus();
int64_t nLastRetargetTime = 1269207250; // NOTE: Not an actual block time
int64_t nLastRetargetTime = 1269205629; // NOTE: Not an actual block time
CBlockIndex pindexLast;
pindexLast.nHeight = 46367;
pindexLast.nTime = 1269211443; // Block #46367 of Bitcoin
// This represents an average difficulty in the current algorithm
pindexLast.nBits = 0x1c387f6f;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c418995);
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c4a93bb);
}
BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)