From 80970985c965f79b8c376c8a922497e385445dd8 Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Wed, 16 Feb 2022 17:51:57 -0500 Subject: coinstats: Split node/coinstats.h to kernel/coinstats.h Most of this commit is pure-move. After this change: - kernel/coinstats.h -> Contains declarations for: - enum class CoinStatsHashType - struct CCoinsStats - GetBogoSize(...) - TxOutSer(...) - ComputeUTXOStats(...) - node/coinstats.h -> Just GetUTXOStats, which will be removed as we change callers to directly use the hashing/indexing codepaths in future commits. --- src/node/coinstats.h | 56 ++-------------------------------------------------- 1 file changed, 2 insertions(+), 54 deletions(-) (limited to 'src/node') diff --git a/src/node/coinstats.h b/src/node/coinstats.h index 8abf1e31e8..fbd5fd4067 100644 --- a/src/node/coinstats.h +++ b/src/node/coinstats.h @@ -6,6 +6,8 @@ #ifndef BITCOIN_NODE_COINSTATS_H #define BITCOIN_NODE_COINSTATS_H +#include + #include #include #include @@ -21,54 +23,6 @@ class BlockManager; } // namespace node namespace node { -enum class CoinStatsHashType { - HASH_SERIALIZED, - MUHASH, - NONE, -}; - -struct CCoinsStats { - int nHeight{0}; - uint256 hashBlock{}; - uint64_t nTransactions{0}; - uint64_t nTransactionOutputs{0}; - uint64_t nBogoSize{0}; - uint256 hashSerialized{}; - uint64_t nDiskSize{0}; - //! The total amount, or nullopt if an overflow occurred calculating it - std::optional total_amount{0}; - - //! The number of coins contained. - uint64_t coins_count{0}; - - //! Signals if the coinstatsindex was used to retrieve the statistics. - bool index_used{false}; - - // Following values are only available from coinstats index - - //! Total cumulative amount of block subsidies up to and including this block - CAmount total_subsidy{0}; - //! Total cumulative amount of unspendable coins up to and including this block - CAmount total_unspendable_amount{0}; - //! Total cumulative amount of prevouts spent up to and including this block - CAmount total_prevout_spent_amount{0}; - //! Total cumulative amount of outputs created up to and including this block - CAmount total_new_outputs_ex_coinbase_amount{0}; - //! Total cumulative amount of coinbase outputs up to and including this block - CAmount total_coinbase_amount{0}; - //! The unspendable coinbase amount from the genesis block - CAmount total_unspendables_genesis_block{0}; - //! The two unspendable coinbase outputs total amount caused by BIP30 - CAmount total_unspendables_bip30{0}; - //! Total cumulative amount of outputs sent to unspendable scripts (OP_RETURN for example) up to and including this block - CAmount total_unspendables_scripts{0}; - //! Total cumulative amount of coins lost due to unclaimed miner rewards up to and including this block - CAmount total_unspendables_unclaimed_rewards{0}; - - CCoinsStats() = default; - CCoinsStats(int block_height, const uint256& block_hash); -}; - /** * Calculate statistics about the unspent transaction output set * @@ -79,12 +33,6 @@ std::optional GetUTXOStats(CCoinsView* view, node::BlockManager& bl const std::function& interruption_point = {}, const CBlockIndex* pindex = nullptr, bool index_requested = true); - -uint64_t GetBogoSize(const CScript& script_pub_key); - -CDataStream TxOutSer(const COutPoint& outpoint, const Coin& coin); - -std::optional ComputeUTXOStats(CoinStatsHashType hash_type, CCoinsView* view, BlockManager& blockman, const std::function& interruption_point = {}); } // namespace node #endif // BITCOIN_NODE_COINSTATS_H -- cgit v1.2.3