diff --git a/src/index/coinstatsindex.cpp b/src/index/coinstatsindex.cpp index c4bc47e538d..666eb4fdb05 100644 --- a/src/index/coinstatsindex.cpp +++ b/src/index/coinstatsindex.cpp @@ -12,10 +12,10 @@ #include #include -using node::CCoinsStats; -using node::GetBogoSize; +using kernel::CCoinsStats; +using kernel::GetBogoSize; using node::ReadBlockFromDisk; -using node::TxOutSer; +using kernel::TxOutSer; using node::UndoReadFromDisk; static constexpr uint8_t DB_BLOCK_HASH{'s'}; diff --git a/src/index/coinstatsindex.h b/src/index/coinstatsindex.h index 315f1fa14aa..cae052d9133 100644 --- a/src/index/coinstatsindex.h +++ b/src/index/coinstatsindex.h @@ -56,7 +56,7 @@ public: explicit CoinStatsIndex(size_t n_cache_size, bool f_memory = false, bool f_wipe = false); // Look up stats for a specific block using CBlockIndex - std::optional LookUpStats(const CBlockIndex* block_index) const; + std::optional LookUpStats(const CBlockIndex* block_index) const; }; /// The global UTXO set hash object. diff --git a/src/kernel/coinstats.cpp b/src/kernel/coinstats.cpp index 49db98d6634..f3808716276 100644 --- a/src/kernel/coinstats.cpp +++ b/src/kernel/coinstats.cpp @@ -15,7 +15,7 @@ #include -namespace node { +namespace kernel { CCoinsStats::CCoinsStats(int block_height, const uint256& block_hash) : nHeight(block_height), @@ -135,7 +135,7 @@ static bool ComputeUTXOStats(CCoinsView* view, CCoinsStats& stats, T hash_obj, c return true; } -std::optional ComputeUTXOStats(CoinStatsHashType hash_type, CCoinsView* view, BlockManager& blockman, const std::function& interruption_point) +std::optional ComputeUTXOStats(CoinStatsHashType hash_type, CCoinsView* view, node::BlockManager& blockman, const std::function& interruption_point) { CBlockIndex* pindex = WITH_LOCK(::cs_main, return blockman.LookupBlockIndex(view->GetBestBlock())); CCoinsStats stats{Assert(pindex)->nHeight, pindex->GetBlockHash()}; @@ -184,4 +184,4 @@ static void FinalizeHash(MuHash3072& muhash, CCoinsStats& stats) } static void FinalizeHash(std::nullptr_t, CCoinsStats& stats) {} -} // namespace node +} // namespace kernel diff --git a/src/kernel/coinstats.h b/src/kernel/coinstats.h index d470ea715ab..a15957233fa 100644 --- a/src/kernel/coinstats.h +++ b/src/kernel/coinstats.h @@ -19,7 +19,7 @@ namespace node { class BlockManager; } // namespace node -namespace node { +namespace kernel { enum class CoinStatsHashType { HASH_SERIALIZED, MUHASH, @@ -73,6 +73,6 @@ uint64_t GetBogoSize(const CScript& script_pub_key); CDataStream TxOutSer(const COutPoint& outpoint, const Coin& coin); std::optional ComputeUTXOStats(CoinStatsHashType hash_type, CCoinsView* view, node::BlockManager& blockman, const std::function& interruption_point = {}); -} // namespace node +} // namespace kernel #endif // BITCOIN_KERNEL_COINSTATS_H diff --git a/src/node/coinstats.cpp b/src/node/coinstats.cpp index 12c8e7b0dac..784d33d698d 100644 --- a/src/node/coinstats.cpp +++ b/src/node/coinstats.cpp @@ -11,10 +11,10 @@ #include namespace node { -std::optional GetUTXOStats(CCoinsView* view, BlockManager& blockman, CoinStatsHashType hash_type, const std::function& interruption_point, const CBlockIndex* pindex, bool index_requested) +std::optional GetUTXOStats(CCoinsView* view, BlockManager& blockman, kernel::CoinStatsHashType hash_type, const std::function& interruption_point, const CBlockIndex* pindex, bool index_requested) { // Use CoinStatsIndex if it is requested and available and a hash_type of Muhash or None was requested - if ((hash_type == CoinStatsHashType::MUHASH || hash_type == CoinStatsHashType::NONE) && g_coin_stats_index && index_requested) { + if ((hash_type == kernel::CoinStatsHashType::MUHASH || hash_type == kernel::CoinStatsHashType::NONE) && g_coin_stats_index && index_requested) { if (pindex) { return g_coin_stats_index->LookUpStats(pindex); } else { @@ -29,6 +29,6 @@ std::optional GetUTXOStats(CCoinsView* view, BlockManager& blockman // best block. assert(!pindex || pindex->GetBlockHash() == view->GetBestBlock()); - return ComputeUTXOStats(hash_type, view, blockman, interruption_point); + return kernel::ComputeUTXOStats(hash_type, view, blockman, interruption_point); } } // namespace node diff --git a/src/node/coinstats.h b/src/node/coinstats.h index fbd5fd40679..b1d1384bb3a 100644 --- a/src/node/coinstats.h +++ b/src/node/coinstats.h @@ -28,8 +28,8 @@ namespace node { * * @param[in] index_requested Signals if the coinstatsindex should be used (when available). */ -std::optional GetUTXOStats(CCoinsView* view, node::BlockManager& blockman, - CoinStatsHashType hash_type, +std::optional GetUTXOStats(CCoinsView* view, node::BlockManager& blockman, + kernel::CoinStatsHashType hash_type, const std::function& interruption_point = {}, const CBlockIndex* pindex = nullptr, bool index_requested = true); diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 97983cea5a5..8789d76f3cb 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -52,8 +52,8 @@ #include using node::BlockManager; -using node::CCoinsStats; -using node::CoinStatsHashType; +using kernel::CCoinsStats; +using kernel::CoinStatsHashType; using node::GetUTXOStats; using node::NodeContext; using node::ReadBlockFromDisk; diff --git a/src/test/coinstatsindex_tests.cpp b/src/test/coinstatsindex_tests.cpp index c3b6870cbd1..50eb4790351 100644 --- a/src/test/coinstatsindex_tests.cpp +++ b/src/test/coinstatsindex_tests.cpp @@ -13,8 +13,8 @@ #include -using node::CCoinsStats; -using node::CoinStatsHashType; +using kernel::CCoinsStats; +using kernel::CoinStatsHashType; BOOST_AUTO_TEST_SUITE(coinstatsindex_tests) diff --git a/src/validation.cpp b/src/validation.cpp index 40c2618db9d..afaea9bb785 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -63,8 +63,8 @@ using node::BlockManager; using node::BlockMap; using node::CBlockIndexHeightOnlyComparator; using node::CBlockIndexWorkComparator; -using node::CCoinsStats; -using node::CoinStatsHashType; +using kernel::CCoinsStats; +using kernel::CoinStatsHashType; using node::fImporting; using node::fPruneMode; using node::fReindex;