diff --git a/src/pow.cpp b/src/pow.cpp index cddd67832ec..1b4d805dc9d 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -245,7 +245,8 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF bnNew.SetCompact(pindexLast->nBits); bnOld = bnNew; // Monacoin: intermediate uint256 can overflow by 1 bit - bool fShift = bnNew.bits() > 235; + const arith_uint256 bnPowLimit = UintToArith256(params.powLimit); + bool fShift = bnNew.bits() > bnPowLimit.bits() - 1; if (fShift) bnNew >>= 1; bnNew *= nActualTimespan; @@ -253,7 +254,6 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF if (fShift) bnNew <<= 1; - const arith_uint256 bnPowLimit = UintToArith256(params.powLimit); if (bnNew > bnPowLimit) bnNew = bnPowLimit;