aboutsummaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-02-17 17:07:48 -0500
committerCarl Dong <contact@carldong.me>2022-05-23 15:19:29 -0400
commit664a14ba7ccb40aa82d35a59831acd35db1897a6 (patch)
treedfe80704af3dbc8b58db42a22359a517c514f4d1 /src/node
parentf1006875665ffe8ff5da8185effe25b860743b4e (diff)
downloadbitcoin-664a14ba7ccb40aa82d35a59831acd35db1897a6.tar.xz
coinstats: Move GetUTXOStats to rpc/blockchain
rpc/blockchain.cpp is now the only user of the vestigial GetUTXOStats(...). And since GetUTXOStats(...)'s special fallback logic was only really relevant/meant for rpc/blockchain.cpp, we can just move it there.
Diffstat (limited to 'src/node')
-rw-r--r--src/node/coinstats.cpp34
-rw-r--r--src/node/coinstats.h38
2 files changed, 0 insertions, 72 deletions
diff --git a/src/node/coinstats.cpp b/src/node/coinstats.cpp
deleted file mode 100644
index 784d33d698..0000000000
--- a/src/node/coinstats.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2010 Satoshi Nakamoto
-// Copyright (c) 2009-2021 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#include <node/coinstats.h>
-
-#include <coins.h>
-#include <index/coinstatsindex.h>
-#include <optional>
-#include <validation.h>
-
-namespace node {
-std::optional<kernel::CCoinsStats> GetUTXOStats(CCoinsView* view, BlockManager& blockman, kernel::CoinStatsHashType hash_type, const std::function<void()>& 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 == kernel::CoinStatsHashType::MUHASH || hash_type == kernel::CoinStatsHashType::NONE) && g_coin_stats_index && index_requested) {
- if (pindex) {
- return g_coin_stats_index->LookUpStats(pindex);
- } else {
- CBlockIndex* block_index = WITH_LOCK(::cs_main, return blockman.LookupBlockIndex(view->GetBestBlock()));
- return g_coin_stats_index->LookUpStats(block_index);
- }
- }
-
- // If the coinstats index isn't requested or is otherwise not usable, the
- // pindex should either be null or equal to the view's best block. This is
- // because without the coinstats index we can only get coinstats about the
- // best block.
- assert(!pindex || pindex->GetBlockHash() == view->GetBestBlock());
-
- return kernel::ComputeUTXOStats(hash_type, view, blockman, interruption_point);
-}
-} // namespace node
diff --git a/src/node/coinstats.h b/src/node/coinstats.h
deleted file mode 100644
index b1d1384bb3..0000000000
--- a/src/node/coinstats.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2010 Satoshi Nakamoto
-// Copyright (c) 2009-2021 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef BITCOIN_NODE_COINSTATS_H
-#define BITCOIN_NODE_COINSTATS_H
-
-#include <kernel/coinstats.h>
-
-#include <chain.h>
-#include <coins.h>
-#include <consensus/amount.h>
-#include <streams.h>
-#include <uint256.h>
-
-#include <cstdint>
-#include <functional>
-
-class CCoinsView;
-namespace node {
-class BlockManager;
-} // namespace node
-
-namespace node {
-/**
- * Calculate statistics about the unspent transaction output set
- *
- * @param[in] index_requested Signals if the coinstatsindex should be used (when available).
- */
-std::optional<kernel::CCoinsStats> GetUTXOStats(CCoinsView* view, node::BlockManager& blockman,
- kernel::CoinStatsHashType hash_type,
- const std::function<void()>& interruption_point = {},
- const CBlockIndex* pindex = nullptr,
- bool index_requested = true);
-} // namespace node
-
-#endif // BITCOIN_NODE_COINSTATS_H