GuessVerificationProgress: cap the ratio to 1

The getblockchaininfo RPC call could sometime return a
'validationprogress' > 1, but this is absurd.
This commit is contained in:
darosior 2019-10-31 15:40:14 +01:00
parent feb1a8c03a
commit 2f5f7d6b13
No known key found for this signature in database
GPG key ID: E13FC145CD3F4304

View file

@ -5066,7 +5066,7 @@ double GuessVerificationProgress(const ChainTxData& data, const CBlockIndex *pin
fTxTotal = pindex->nChainTx + (nNow - pindex->GetBlockTime()) * data.dTxRate;
}
return pindex->nChainTx / fTxTotal;
return std::min<double>(pindex->nChainTx / fTxTotal, 1.0);
}
class CMainCleanup