Guess how far we are in the verification process at the given block index require cs_main if pindex has not been validated yet (because nChainTx might be unset)
| 5082 | //! Guess how far we are in the verification process at the given block index |
| 5083 | //! require cs_main if pindex has not been validated yet (because nChainTx might be unset) |
| 5084 | double GuessVerificationProgress(const ChainTxData& data, const CBlockIndex *pindex) { |
| 5085 | if (pindex == nullptr) |
| 5086 | return 0.0; |
| 5087 | |
| 5088 | int64_t nNow = time(nullptr); |
| 5089 | |
| 5090 | double fTxTotal; |
| 5091 | |
| 5092 | if (pindex->nChainTx <= data.nTxCount) { |
| 5093 | fTxTotal = data.nTxCount + (nNow - data.nTime) * data.dTxRate; |
| 5094 | } else { |
| 5095 | fTxTotal = pindex->nChainTx + (nNow - pindex->GetBlockTime()) * data.dTxRate; |
| 5096 | } |
| 5097 | |
| 5098 | return pindex->nChainTx / fTxTotal; |
| 5099 | } |
| 5100 | |
| 5101 | class CMainCleanup |
| 5102 | { |
no test coverage detected