Merge #17328: GuessVerificationProgress: cap the ratio to 1

2f5f7d6b13 GuessVerificationProgress: cap the ratio to 1 (darosior)

Pull request description:

  Noticed `getblockchaininfo` would return a `verificationprogress` > 1, especially while generating. This caps the verification progress to `1`.

  Tried to append a check to functional tests but this would pass even without the patch, so it seems better to not add a superfluous check (but this can easily be reproduced by trying to generate blocks in the background and `watch`ing `getblockchainfo`).

ACKs for top commit:
  laanwj:
    ACK 2f5f7d6b13
  promag:
    ACK 2f5f7d6b13.

Tree-SHA512: fa3aca12acab9c14dab3b2cc94351082f548ea6e6c588987cd86e928a00feb023e8112433658a0e85084e294bfd940eaafa33fb46c4add94146a0901bc1c4f80
This commit is contained in:
Wladimir J. van der Laan 2019-11-18 14:13:26 +01:00
commit 63fac52f31
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D

View file

@ -5089,7 +5089,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