mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-18 19:40:40 +01:00
index, rpc: Add use_index option for gettxoutsetinfo
This commit is contained in:
@@ -104,9 +104,9 @@ static bool GetUTXOStats(CCoinsView* view, BlockManager& blockman, CCoinsStats&
|
||||
stats.nHeight = Assert(pindex)->nHeight;
|
||||
stats.hashBlock = pindex->GetBlockHash();
|
||||
|
||||
// Use CoinStatsIndex if it is available and a hash_type of Muhash or None was requested
|
||||
if ((stats.m_hash_type == CoinStatsHashType::MUHASH || stats.m_hash_type == CoinStatsHashType::NONE) && g_coin_stats_index) {
|
||||
stats.from_index = true;
|
||||
// Use CoinStatsIndex if it is requested and available and a hash_type of Muhash or None was requested
|
||||
if ((stats.m_hash_type == CoinStatsHashType::MUHASH || stats.m_hash_type == CoinStatsHashType::NONE) && g_coin_stats_index && stats.index_requested) {
|
||||
stats.index_used = true;
|
||||
return g_coin_stats_index->LookUpStats(pindex, stats);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,10 @@ struct CCoinsStats
|
||||
//! The number of coins contained.
|
||||
uint64_t coins_count{0};
|
||||
|
||||
bool from_index{false};
|
||||
//! Signals if the coinstatsindex should be used (when available).
|
||||
bool index_requested{true};
|
||||
//! Signals if the coinstatsindex was used to retrieve the statistics.
|
||||
bool index_used{false};
|
||||
|
||||
// Following values are only available from coinstats index
|
||||
CAmount total_subsidy{0};
|
||||
|
||||
Reference in New Issue
Block a user