Branch data Line data Source code
# 1 : : // Copyright (c) 2010 Satoshi Nakamoto # 2 : : // Copyright (c) 2009-2020 The Bitcoin Core developers # 3 : : // Distributed under the MIT software license, see the accompanying # 4 : : // file COPYING or http://www.opensource.org/licenses/mit-license.php. # 5 : : # 6 : : #ifndef BITCOIN_NODE_COINSTATS_H # 7 : : #define BITCOIN_NODE_COINSTATS_H # 8 : : # 9 : : #include <amount.h> # 10 : : #include <chain.h> # 11 : : #include <coins.h> # 12 : : #include <streams.h> # 13 : : #include <uint256.h> # 14 : : # 15 : : #include <cstdint> # 16 : : #include <functional> # 17 : : # 18 : : class BlockManager; # 19 : : class CCoinsView; # 20 : : # 21 : : enum class CoinStatsHashType { # 22 : : HASH_SERIALIZED, # 23 : : MUHASH, # 24 : : NONE, # 25 : : }; # 26 : : # 27 : : struct CCoinsStats # 28 : : { # 29 : : CoinStatsHashType m_hash_type; # 30 : : int nHeight{0}; # 31 : : uint256 hashBlock{}; # 32 : : uint64_t nTransactions{0}; # 33 : : uint64_t nTransactionOutputs{0}; # 34 : : uint64_t nBogoSize{0}; # 35 : : uint256 hashSerialized{}; # 36 : : uint64_t nDiskSize{0}; # 37 : : CAmount nTotalAmount{0}; # 38 : : # 39 : : //! The number of coins contained. # 40 : : uint64_t coins_count{0}; # 41 : : # 42 : : //! Signals if the coinstatsindex should be used (when available). # 43 : : bool index_requested{true}; # 44 : : //! Signals if the coinstatsindex was used to retrieve the statistics. # 45 : : bool index_used{false}; # 46 : : # 47 : : // Following values are only available from coinstats index # 48 : : CAmount total_subsidy{0}; # 49 : : CAmount block_unspendable_amount{0}; # 50 : : CAmount block_prevout_spent_amount{0}; # 51 : : CAmount block_new_outputs_ex_coinbase_amount{0}; # 52 : : CAmount block_coinbase_amount{0}; # 53 : : CAmount unspendables_genesis_block{0}; # 54 : : CAmount unspendables_bip30{0}; # 55 : : CAmount unspendables_scripts{0}; # 56 : : CAmount unspendables_unclaimed_rewards{0}; # 57 : : # 58 : 309 : CCoinsStats(CoinStatsHashType hash_type) : m_hash_type(hash_type) {} # 59 : : }; # 60 : : # 61 : : //! Calculate statistics about the unspent transaction output set # 62 : : bool GetUTXOStats(CCoinsView* view, BlockManager& blockman, CCoinsStats& stats, const std::function<void()>& interruption_point = {}, const CBlockIndex* pindex = nullptr); # 63 : : # 64 : : uint64_t GetBogoSize(const CScript& script_pub_key); # 65 : : # 66 : : CDataStream TxOutSer(const COutPoint& outpoint, const Coin& coin); # 67 : : # 68 : : #endif // BITCOIN_NODE_COINSTATS_H