From 6d65019981b96e722a553f748b3783c8c1104a6b Mon Sep 17 00:00:00 2001 From: romanornr Date: Sat, 8 Jul 2017 12:10:01 +0200 Subject: [PATCH] Monacoin: Zeitgeist2 bool fshift bnNew.bits() --- src/pow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;