From 6168411bb2c78e971c74aedd801319f728ca02e2 Mon Sep 17 00:00:00 2001 From: miningplanet Date: Sat, 2 Dec 2023 13:45:51 +0100 Subject: [PATCH] Small chain validatino improvement. --- src/pow.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pow.cpp b/src/pow.cpp index ddcdb6865..5dd199007 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -231,18 +231,22 @@ unsigned int GetNextWorkRequiredV3(const CBlockIndex* pindexLast, const Consensu if (nAdjustments > 0) { for (int i = 0; i < nAdjustments; i++) { + if (bnNew > powLimit) { + bnNew = powLimit; + return bnNew.GetCompact(); + } bnNew *= 100; bnNew /= multiplicator; } } else { for (int i = 0; i < -nAdjustments; i++) { - bnNew *= multiplicator; - bnNew /= 100; if (bnNew > powLimit) { bnNew = powLimit; - break; + return bnNew.GetCompact(); } + bnNew *= multiplicator; + bnNew /= 100; } }