Update tests for new difficulty algorithm

This commit is contained in:
Jack Grigg
2016-06-08 14:21:04 +12:00
parent f2c48e15e5
commit 284e125957
2 changed files with 118 additions and 117 deletions

View File

@@ -19,12 +19,12 @@ BOOST_AUTO_TEST_CASE(get_next_work)
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus();
int64_t nLastRetargetTime = 1261130161; // Block #30240
int64_t nLastRetargetTime = 1262149169; // NOTE: Not an actual block time
CBlockIndex pindexLast;
pindexLast.nHeight = 32255;
pindexLast.nTime = 1262152739; // Block #32255
pindexLast.nBits = 0x1d00ffff;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00d86a);
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d011998);
}
/* Test the constraint on the upper bound for next work */
@@ -48,12 +48,12 @@ BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual)
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus();
int64_t nLastRetargetTime = 1279008237; // Block #66528
int64_t nLastRetargetTime = 1279295950; // NOTE: Not an actual block time
CBlockIndex pindexLast;
pindexLast.nHeight = 68543;
pindexLast.nTime = 1279297671; // Block #68543
pindexLast.nBits = 0x1c05a3f4;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0168fc);
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c05306f);
}
/* Test the constraint on the upper bound for actual time taken */
@@ -62,12 +62,12 @@ BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual)
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus();
int64_t nLastRetargetTime = 1263163443; // NOTE: Not an actual block time
int64_t nLastRetargetTime = 1269207250; // NOTE: Not an actual block time
CBlockIndex pindexLast;
pindexLast.nHeight = 46367;
pindexLast.nTime = 1269211443; // Block #46367
pindexLast.nBits = 0x1c387f6f;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00e1fd);
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c418995);
}
BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)