Changeset View
Changeset View
Standalone View
Standalone View
src/node/coinstats.cpp
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | static bool GetUTXOStats(CCoinsView *view, BlockManager &blockman, | ||||
CCoinsStats &stats, T hash_obj, | CCoinsStats &stats, T hash_obj, | ||||
const std::function<void()> &interruption_point, | const std::function<void()> &interruption_point, | ||||
const CBlockIndex *pindex) { | const CBlockIndex *pindex) { | ||||
std::unique_ptr<CCoinsViewCursor> pcursor(view->Cursor()); | std::unique_ptr<CCoinsViewCursor> pcursor(view->Cursor()); | ||||
assert(pcursor); | assert(pcursor); | ||||
if (!pindex) { | if (!pindex) { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
assert(std::addressof(g_chainman.m_blockman) == | |||||
std::addressof(blockman)); | |||||
pindex = blockman.LookupBlockIndex(view->GetBestBlock()); | pindex = blockman.LookupBlockIndex(view->GetBestBlock()); | ||||
} | } | ||||
stats.nHeight = Assert(pindex)->nHeight; | stats.nHeight = Assert(pindex)->nHeight; | ||||
stats.hashBlock = pindex->GetBlockHash(); | stats.hashBlock = pindex->GetBlockHash(); | ||||
// Use CoinStatsIndex if it is requested and available and a hash_type of | // Use CoinStatsIndex if it is requested and available and a hash_type of | ||||
// Muhash or None was requested | // Muhash or None was requested | ||||
if ((stats.m_hash_type == CoinStatsHashType::MUHASH || | if ((stats.m_hash_type == CoinStatsHashType::MUHASH || | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |