MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / GuessVerificationProgress

Function GuessVerificationProgress

src/validation.cpp:5084–5099  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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)
5084double 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
5101class CMainCleanup
5102{

Callers 7

UpdateTipFunction · 0.85
LoadChainTipFunction · 0.85
getblockchaininfoFunction · 0.85
handleNotifyBlockTipMethod · 0.85
handleNotifyHeaderTipMethod · 0.85

Calls 1

GetBlockTimeMethod · 0.45

Tested by

no test coverage detected