1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2019 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 <uint256.h>
11 
12 #include <cstdint>
13 #include <functional>
14 
15 class CCoinsView;
16 
17 enum class CoinStatsHashType {
18     HASH_SERIALIZED,
19     NONE,
20 };
21 
22 struct CCoinsStats
23 {
24     int nHeight{0};
25     uint256 hashBlock{};
26     uint64_t nTransactions{0};
27     uint64_t nTransactionOutputs{0};
28     uint64_t nBogoSize{0};
29     uint256 hashSerialized{};
30     uint64_t nDiskSize{0};
31     CAmount nCoinAmount{0};
32     CAmount nNameAmount{0};
33 
34     //! The number of coins contained.
35     uint64_t coins_count{0};
36 };
37 
38 //! Calculate statistics about the unspent transaction output set
39 bool GetUTXOStats(CCoinsView* view, CCoinsStats& stats, const CoinStatsHashType hash_type, const std::function<void()>& interruption_point = {});
40 
41 #endif // BITCOIN_NODE_COINSTATS_H
42