Bitcoin ABC 0.32.5
P2P Digital Currency
coinstats.h
Go to the documentation of this file.
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 <chain.h>
9#include <coins.h>
10#include <consensus/amount.h>
11#include <streams.h>
12#include <uint256.h>
13
14#include <cstdint>
15#include <functional>
16#include <optional>
17
18class CCoinsView;
19namespace node {
20class BlockManager;
21} // namespace node
22
23namespace kernel {
26 MUHASH,
27 NONE,
28};
29
31 int nHeight{0};
33 uint64_t nTransactions{0};
35 uint64_t nBogoSize{0};
37 uint64_t nDiskSize{0};
39 std::optional<Amount> total_amount{Amount::zero()};
40
42 uint64_t coins_count{0};
43
45 bool index_used{false};
46
47 // Following values are only available from coinstats index
48
73
74 CCoinsStats() = default;
75 CCoinsStats(int block_height, const BlockHash &block_hash);
76};
77
78uint64_t GetBogoSize(const CScript &script_pub_key);
79
80DataStream TxOutSer(const COutPoint &outpoint, const Coin &coin);
81
82std::optional<CCoinsStats>
84 node::BlockManager &blockman,
85 const std::function<void()> &interruption_point = {});
86} // namespace kernel
87
88#endif // BITCOIN_KERNEL_COINSTATS_H
Abstract view on the open txout dataset.
Definition: coins.h:305
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:20
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:432
A UTXO entry.
Definition: coins.h:29
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:174
Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most-w...
Definition: blockstorage.h:107
256-bit opaque blob.
Definition: uint256.h:129
Definition: init.h:28
static bool ComputeUTXOStats(CCoinsView *view, CCoinsStats &stats, T hash_obj, const std::function< void()> &interruption_point)
Calculate statistics about the unspent transaction output set.
Definition: coinstats.cpp:95
CoinStatsHashType
Definition: coinstats.h:24
DataStream TxOutSer(const COutPoint &outpoint, const Coin &coin)
Definition: coinstats.cpp:28
uint64_t GetBogoSize(const CScript &script_pub_key)
Definition: coinstats.cpp:22
Definition: init.h:31
Definition: amount.h:21
static constexpr Amount zero() noexcept
Definition: amount.h:34
A BlockHash is a unqiue identifier for a block.
Definition: blockhash.h:13
Amount total_subsidy
Total cumulative amount of block subsidies up to and including this block.
Definition: coinstats.h:51
uint64_t nDiskSize
Definition: coinstats.h:37
Amount total_unspendables_scripts
Total cumulative amount of outputs sent to unspendable scripts (OP_RETURN for example) up to and incl...
Definition: coinstats.h:69
Amount total_coinbase_amount
Total cumulative amount of coinbase outputs up to and including this block.
Definition: coinstats.h:62
Amount total_unspendables_genesis_block
The unspendable coinbase amount from the genesis block.
Definition: coinstats.h:64
uint64_t coins_count
The number of coins contained.
Definition: coinstats.h:42
uint64_t nTransactions
Definition: coinstats.h:33
uint64_t nTransactionOutputs
Definition: coinstats.h:34
uint64_t nBogoSize
Definition: coinstats.h:35
bool index_used
Signals if the coinstatsindex was used to retrieve the statistics.
Definition: coinstats.h:45
Amount total_unspendables_bip30
The two unspendable coinbase outputs total amount caused by BIP30.
Definition: coinstats.h:66
Amount total_prevout_spent_amount
Total cumulative amount of prevouts spent up to and including this block.
Definition: coinstats.h:56
BlockHash hashBlock
Definition: coinstats.h:32
Amount total_unspendables_unclaimed_rewards
Total cumulative amount of coins lost due to unclaimed miner rewards up to and including this block.
Definition: coinstats.h:72
uint256 hashSerialized
Definition: coinstats.h:36
std::optional< Amount > total_amount
The total amount, or nullopt if an overflow occurred calculating it.
Definition: coinstats.h:39
Amount total_new_outputs_ex_coinbase_amount
Total cumulative amount of outputs created up to and including this block.
Definition: coinstats.h:59
Amount total_unspendable_amount
Total cumulative amount of unspendable coins up to and including this block.
Definition: coinstats.h:54