MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / GetBackgroundVerificationProgress

Method GetBackgroundVerificationProgress

src/validation.cpp:5546–5557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5544}
5545
5546double ChainstateManager::GetBackgroundVerificationProgress(const CBlockIndex& pindex) const
5547{
5548 AssertLockHeld(GetMutex());
5549 Assert(HistoricalChainstate());
5550 auto target_block = HistoricalChainstate()->TargetBlock();
5551
5552 if (pindex.m_chain_tx_count == 0 || target_block->m_chain_tx_count == 0) {
5553 LogDebug(BCLog::VALIDATION, "[background validation] Block %d has unset m_chain_tx_count. Unable to estimate verification progress.", pindex.nHeight);
5554 return 0.0;
5555 }
5556 return static_cast<double>(pindex.m_chain_tx_count) / static_cast<double>(target_block->m_chain_tx_count);
5557}
5558
5559Chainstate& ChainstateManager::InitializeChainstate(CTxMemPool* mempool)
5560{

Callers 2

EXCLUSIVE_LOCKS_REQUIREDFunction · 0.80
getblockchaininfoFunction · 0.80

Calls 1

TargetBlockMethod · 0.80

Tested by

no test coverage detected