diff options
Diffstat (limited to 'src/index')
-rw-r--r-- | src/index/coinstatsindex.cpp | 7 | ||||
-rw-r--r-- | src/index/coinstatsindex.h | 11 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/index/coinstatsindex.cpp b/src/index/coinstatsindex.cpp index b9029e946a..99a1310c9e 100644 --- a/src/index/coinstatsindex.cpp +++ b/src/index/coinstatsindex.cpp @@ -6,6 +6,7 @@ #include <coins.h> #include <crypto/muhash.h> #include <index/coinstatsindex.h> +#include <kernel/coinstats.h> #include <node/blockstorage.h> #include <serialize.h> #include <txdb.h> @@ -322,13 +323,13 @@ static bool LookUpOne(const CDBWrapper& db, const interfaces::BlockKey& block, D return db.Read(DBHashKey(block.hash), result); } -std::optional<CCoinsStats> CoinStatsIndex::LookUpStats(const CBlockIndex* block_index) const +std::optional<CCoinsStats> CoinStatsIndex::LookUpStats(const CBlockIndex& block_index) const { - CCoinsStats stats{Assert(block_index)->nHeight, block_index->GetBlockHash()}; + CCoinsStats stats{block_index.nHeight, block_index.GetBlockHash()}; stats.index_used = true; DBVal entry; - if (!LookUpOne(*m_db, {block_index->GetBlockHash(), block_index->nHeight}, entry)) { + if (!LookUpOne(*m_db, {block_index.GetBlockHash(), block_index.nHeight}, entry)) { return std::nullopt; } diff --git a/src/index/coinstatsindex.h b/src/index/coinstatsindex.h index c4af223388..7375a85750 100644 --- a/src/index/coinstatsindex.h +++ b/src/index/coinstatsindex.h @@ -5,11 +5,14 @@ #ifndef BITCOIN_INDEX_COINSTATSINDEX_H #define BITCOIN_INDEX_COINSTATSINDEX_H -#include <chain.h> #include <crypto/muhash.h> -#include <flatfile.h> #include <index/base.h> -#include <kernel/coinstats.h> + +class CBlockIndex; +class CDBBatch; +namespace kernel { +struct CCoinsStats; +} /** * CoinStatsIndex maintains statistics on the UTXO set. @@ -56,7 +59,7 @@ public: explicit CoinStatsIndex(std::unique_ptr<interfaces::Chain> chain, size_t n_cache_size, bool f_memory = false, bool f_wipe = false); // Look up stats for a specific block using CBlockIndex - std::optional<kernel::CCoinsStats> LookUpStats(const CBlockIndex* block_index) const; + std::optional<kernel::CCoinsStats> LookUpStats(const CBlockIndex& block_index) const; }; /// The global UTXO set hash object. |