aboutsummaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorFabian Jahr <fjahr@protonmail.com>2021-02-28 19:27:00 +0100
committerFabian Jahr <fjahr@protonmail.com>2021-04-19 21:11:33 +0200
commitb9362392aef2689bc106c20925859ede555d082b (patch)
treeb8437b8db02cfe99a5d0626bdf16b6699b477eaf /src/node
parentbb7788b121a30489bc81a1f46dde6a9b19ae4ec1 (diff)
index, rpc: Add use_index option for gettxoutsetinfo
Diffstat (limited to 'src/node')
-rw-r--r--src/node/coinstats.cpp6
-rw-r--r--src/node/coinstats.h5
2 files changed, 7 insertions, 4 deletions
diff --git a/src/node/coinstats.cpp b/src/node/coinstats.cpp
index eacd7e2ab5..38c1d29250 100644
--- a/src/node/coinstats.cpp
+++ b/src/node/coinstats.cpp
@@ -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);
}
diff --git a/src/node/coinstats.h b/src/node/coinstats.h
index ba565eba43..8be256edc9 100644
--- a/src/node/coinstats.h
+++ b/src/node/coinstats.h
@@ -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};