LCOV - code coverage report
Current view: top level - src/kernel - coinstats.h (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 0 20 0.0 %
Date: 2023-09-26 12:08:55 Functions: 0 1 0.0 %

          Line data    Source code
       1             : // Copyright (c) 2022 The Bitcoin Core developers
       2             : // Distributed under the MIT software license, see the accompanying
       3             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4             : 
       5             : #ifndef BITCOIN_KERNEL_COINSTATS_H
       6             : #define BITCOIN_KERNEL_COINSTATS_H
       7             : 
       8             : #include <consensus/amount.h>
       9             : #include <streams.h>
      10             : #include <uint256.h>
      11             : 
      12             : #include <cstdint>
      13             : #include <functional>
      14             : #include <optional>
      15             : 
      16             : class CCoinsView;
      17             : class Coin;
      18             : class COutPoint;
      19             : class CScript;
      20             : namespace node {
      21             : class BlockManager;
      22             : } // namespace node
      23             : 
      24             : namespace kernel {
      25             : enum class CoinStatsHashType {
      26             :     HASH_SERIALIZED,
      27             :     MUHASH,
      28             :     NONE,
      29             : };
      30             : 
      31             : struct CCoinsStats {
      32           0 :     int nHeight{0};
      33           0 :     uint256 hashBlock{};
      34           0 :     uint64_t nTransactions{0};
      35           0 :     uint64_t nTransactionOutputs{0};
      36           0 :     uint64_t nBogoSize{0};
      37           0 :     uint256 hashSerialized{};
      38           0 :     uint64_t nDiskSize{0};
      39             :     //! The total amount, or nullopt if an overflow occurred calculating it
      40           0 :     std::optional<CAmount> total_amount{0};
      41             : 
      42             :     //! The number of coins contained.
      43           0 :     uint64_t coins_count{0};
      44             : 
      45             :     //! Signals if the coinstatsindex was used to retrieve the statistics.
      46           0 :     bool index_used{false};
      47             : 
      48             :     // Following values are only available from coinstats index
      49             : 
      50             :     //! Total cumulative amount of block subsidies up to and including this block
      51           0 :     CAmount total_subsidy{0};
      52             :     //! Total cumulative amount of unspendable coins up to and including this block
      53           0 :     CAmount total_unspendable_amount{0};
      54             :     //! Total cumulative amount of prevouts spent up to and including this block
      55           0 :     CAmount total_prevout_spent_amount{0};
      56             :     //! Total cumulative amount of outputs created up to and including this block
      57           0 :     CAmount total_new_outputs_ex_coinbase_amount{0};
      58             :     //! Total cumulative amount of coinbase outputs up to and including this block
      59           0 :     CAmount total_coinbase_amount{0};
      60             :     //! The unspendable coinbase amount from the genesis block
      61           0 :     CAmount total_unspendables_genesis_block{0};
      62             :     //! The two unspendable coinbase outputs total amount caused by BIP30
      63           0 :     CAmount total_unspendables_bip30{0};
      64             :     //! Total cumulative amount of outputs sent to unspendable scripts (OP_RETURN for example) up to and including this block
      65           0 :     CAmount total_unspendables_scripts{0};
      66             :     //! Total cumulative amount of coins lost due to unclaimed miner rewards up to and including this block
      67           0 :     CAmount total_unspendables_unclaimed_rewards{0};
      68             : 
      69           0 :     CCoinsStats() = default;
      70             :     CCoinsStats(int block_height, const uint256& block_hash);
      71             : };
      72             : 
      73             : uint64_t GetBogoSize(const CScript& script_pub_key);
      74             : 
      75             : DataStream TxOutSer(const COutPoint& outpoint, const Coin& coin);
      76             : 
      77             : std::optional<CCoinsStats> ComputeUTXOStats(CoinStatsHashType hash_type, CCoinsView* view, node::BlockManager& blockman, const std::function<void()>& interruption_point = {});
      78             : } // namespace kernel
      79             : 
      80             : #endif // BITCOIN_KERNEL_COINSTATS_H

Generated by: LCOV version 1.14