Fix pow_tests to work with Equihash
Changing the order of difficulty calculation operations to divide first doesn't affect the result significantly, but ensures we never overflow the arith_uint256 during multiplication and get an artificial jump in difficulty.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user