Changeset View
Changeset View
Standalone View
Standalone View
src/node/coinstats.cpp
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | if (!pindex) { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
assert(std::addressof(g_chainman.m_blockman) == | assert(std::addressof(g_chainman.m_blockman) == | ||||
std::addressof(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 available and a hash_type of Muhash or None | // Use CoinStatsIndex if it is requested and available and a hash_type of | ||||
// was requested | // Muhash or None was requested | ||||
if ((stats.m_hash_type == CoinStatsHashType::MUHASH || | if ((stats.m_hash_type == CoinStatsHashType::MUHASH || | ||||
stats.m_hash_type == CoinStatsHashType::NONE) && | stats.m_hash_type == CoinStatsHashType::NONE) && | ||||
g_coin_stats_index) { | g_coin_stats_index && stats.index_requested) { | ||||
stats.from_index = true; | stats.index_used = true; | ||||
return g_coin_stats_index->LookUpStats(pindex, stats); | return g_coin_stats_index->LookUpStats(pindex, stats); | ||||
} | } | ||||
PrepareHash(hash_obj, stats); | PrepareHash(hash_obj, stats); | ||||
TxId prevkey; | TxId prevkey; | ||||
std::map<uint32_t, Coin> outputs; | std::map<uint32_t, Coin> outputs; | ||||
while (pcursor->Valid()) { | while (pcursor->Valid()) { | ||||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |