mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-13 16:48:08 +00:00
Fixed POW test cases.
This commit is contained in:
parent
e4376fdcb5
commit
781e53a22b
@ -65,7 +65,6 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
|||||||
|
|
||||||
assert(pindexFirst);
|
assert(pindexFirst);
|
||||||
|
|
||||||
//return CalculateNextWorkRequired(pindexLast, pindexFirst->GetBlockTime(), params);
|
|
||||||
return CalculateDigishieldNextWorkRequired(pindexLast, pindexFirst->GetBlockTime(), params);
|
return CalculateDigishieldNextWorkRequired(pindexLast, pindexFirst->GetBlockTime(), params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class CBlockIndex;
|
|||||||
class uint256;
|
class uint256;
|
||||||
|
|
||||||
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params&);
|
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params&);
|
||||||
unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params&);
|
unsigned int CalculateDigishieldNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params);
|
||||||
|
|
||||||
/** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */
|
/** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */
|
||||||
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params&);
|
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params&);
|
||||||
|
@ -22,7 +22,7 @@ BOOST_AUTO_TEST_CASE(get_next_work)
|
|||||||
pindexLast.nHeight = 280223;
|
pindexLast.nHeight = 280223;
|
||||||
pindexLast.nTime = 1358378777; // Block #280223
|
pindexLast.nTime = 1358378777; // Block #280223
|
||||||
pindexLast.nBits = 0x1c0ac141;
|
pindexLast.nBits = 0x1c0ac141;
|
||||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1c093f8d);
|
BOOST_CHECK_EQUAL(CalculateDigishieldNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1c1021e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test the constraint on the upper bound for next work */
|
/* Test the constraint on the upper bound for next work */
|
||||||
@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_pow_limit)
|
|||||||
pindexLast.nHeight = 2015;
|
pindexLast.nHeight = 2015;
|
||||||
pindexLast.nTime = 1318480354; // Block #2015
|
pindexLast.nTime = 1318480354; // Block #2015
|
||||||
pindexLast.nBits = 0x1e0ffff0;
|
pindexLast.nBits = 0x1e0ffff0;
|
||||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1e0fffff);
|
BOOST_CHECK_EQUAL(CalculateDigishieldNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1e17ffe8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test the constraint on the lower bound for actual time taken */
|
/* Test the constraint on the lower bound for actual time taken */
|
||||||
@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual)
|
|||||||
pindexLast.nHeight = 578591;
|
pindexLast.nHeight = 578591;
|
||||||
pindexLast.nTime = 1401757934; // Block #578591
|
pindexLast.nTime = 1401757934; // Block #578591
|
||||||
pindexLast.nBits = 0x1b075cf1;
|
pindexLast.nBits = 0x1b075cf1;
|
||||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1b01d73c);
|
BOOST_CHECK_EQUAL(CalculateDigishieldNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1b0b0b69);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test the constraint on the upper bound for actual time taken */
|
/* Test the constraint on the upper bound for actual time taken */
|
||||||
@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual)
|
|||||||
pindexLast.nHeight = 1001951;
|
pindexLast.nHeight = 1001951;
|
||||||
pindexLast.nTime = 1464900315; // Block #46367
|
pindexLast.nTime = 1464900315; // Block #46367
|
||||||
pindexLast.nBits = 0x1b015318;
|
pindexLast.nBits = 0x1b015318;
|
||||||
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1b054c60);
|
BOOST_CHECK_EQUAL(CalculateDigishieldNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1b01fca4);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)
|
BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)
|
||||||
|
Loading…
Reference in New Issue
Block a user