Bitcoin Core  21.99.0
P2P Digital Currency
Functions
coinstats.cpp File Reference
#include <node/coinstats.h>
#include <coins.h>
#include <crypto/muhash.h>
#include <hash.h>
#include <serialize.h>
#include <uint256.h>
#include <util/system.h>
#include <validation.h>
#include <map>
Include dependency graph for coinstats.cpp:

Go to the source code of this file.

Functions

static uint64_t GetBogoSize (const CScript &scriptPubKey)
 
static void ApplyHash (CCoinsStats &stats, CHashWriter &ss, const uint256 &hash, const std::map< uint32_t, Coin > &outputs, std::map< uint32_t, Coin >::const_iterator it)
 
static void ApplyHash (CCoinsStats &stats, std::nullptr_t, const uint256 &hash, const std::map< uint32_t, Coin > &outputs, std::map< uint32_t, Coin >::const_iterator it)
 
static void ApplyHash (CCoinsStats &stats, MuHash3072 &muhash, const uint256 &hash, const std::map< uint32_t, Coin > &outputs, std::map< uint32_t, Coin >::const_iterator it)
 
template<typename T >
static void ApplyStats (CCoinsStats &stats, T &hash_obj, const uint256 &hash, const std::map< uint32_t, Coin > &outputs)
 Warning: be very careful when changing this! assumeutxo and UTXO snapshot validation commitments are reliant on the hash constructed by this function. More...
 
template<typename T >
static bool GetUTXOStats (CCoinsView *view, BlockManager &blockman, CCoinsStats &stats, T hash_obj, const std::function< void()> &interruption_point)
 Calculate statistics about the unspent transaction output set. More...
 
bool GetUTXOStats (CCoinsView *view, BlockManager &blockman, CCoinsStats &stats, CoinStatsHashType hash_type, const std::function< void()> &interruption_point)
 Calculate statistics about the unspent transaction output set. More...
 
static void PrepareHash (CHashWriter &ss, const CCoinsStats &stats)
 
static void PrepareHash (MuHash3072 &muhash, CCoinsStats &stats)
 
static void PrepareHash (std::nullptr_t, CCoinsStats &stats)
 
static void FinalizeHash (CHashWriter &ss, CCoinsStats &stats)
 
static void FinalizeHash (MuHash3072 &muhash, CCoinsStats &stats)
 
static void FinalizeHash (std::nullptr_t, CCoinsStats &stats)
 

Function Documentation

◆ ApplyHash() [1/3]

static void ApplyHash ( CCoinsStats stats,
CHashWriter ss,
const uint256 hash,
const std::map< uint32_t, Coin > &  outputs,
std::map< uint32_t, Coin >::const_iterator  it 
)
static

Definition at line 29 of file coinstats.cpp.

Here is the caller graph for this function:

◆ ApplyHash() [2/3]

static void ApplyHash ( CCoinsStats stats,
MuHash3072 muhash,
const uint256 hash,
const std::map< uint32_t, Coin > &  outputs,
std::map< uint32_t, Coin >::const_iterator  it 
)
static

Definition at line 47 of file coinstats.cpp.

Here is the call graph for this function:

◆ ApplyHash() [3/3]

static void ApplyHash ( CCoinsStats stats,
std::nullptr_t  ,
const uint256 hash,
const std::map< uint32_t, Coin > &  outputs,
std::map< uint32_t, Coin >::const_iterator  it 
)
static

Definition at line 45 of file coinstats.cpp.

◆ ApplyStats()

template<typename T >
static void ApplyStats ( CCoinsStats stats,
T &  hash_obj,
const uint256 hash,
const std::map< uint32_t, Coin > &  outputs 
)
static

Warning: be very careful when changing this! assumeutxo and UTXO snapshot validation commitments are reliant on the hash constructed by this function.

If the construction of this hash is changed, it will invalidate existing UTXO snapshots. This will not result in any kind of consensus failure, but it will force clients that were expecting to make use of assumeutxo to do traditional IBD instead.

It is also possible, though very unlikely, that a change in this construction could cause a previously invalid (and potentially malicious) UTXO snapshot to be considered valid.

Definition at line 72 of file coinstats.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FinalizeHash() [1/3]

static void FinalizeHash ( CHashWriter ss,
CCoinsStats stats 
)
static

Definition at line 159 of file coinstats.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FinalizeHash() [2/3]

static void FinalizeHash ( MuHash3072 muhash,
CCoinsStats stats 
)
static

Definition at line 163 of file coinstats.cpp.

Here is the call graph for this function:

◆ FinalizeHash() [3/3]

static void FinalizeHash ( std::nullptr_t  ,
CCoinsStats stats 
)
static

Definition at line 169 of file coinstats.cpp.

◆ GetBogoSize()

static uint64_t GetBogoSize ( const CScript scriptPubKey)
static

Definition at line 19 of file coinstats.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetUTXOStats() [1/2]

bool GetUTXOStats ( CCoinsView view,
BlockManager blockman,
CCoinsStats stats,
CoinStatsHashType  hash_type,
const std::function< void()> &  interruption_point 
)

Calculate statistics about the unspent transaction output set.

Definition at line 132 of file coinstats.cpp.

Here is the call graph for this function:

◆ GetUTXOStats() [2/2]

template<typename T >
static bool GetUTXOStats ( CCoinsView view,
BlockManager blockman,
CCoinsStats stats,
hash_obj,
const std::function< void()> &  interruption_point 
)
static

Calculate statistics about the unspent transaction output set.

Definition at line 87 of file coinstats.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrepareHash() [1/3]

static void PrepareHash ( CHashWriter ss,
const CCoinsStats stats 
)
static

Definition at line 151 of file coinstats.cpp.

Here is the caller graph for this function:

◆ PrepareHash() [2/3]

static void PrepareHash ( MuHash3072 muhash,
CCoinsStats stats 
)
static

Definition at line 156 of file coinstats.cpp.

◆ PrepareHash() [3/3]

static void PrepareHash ( std::nullptr_t  ,
CCoinsStats stats 
)
static

Definition at line 157 of file coinstats.cpp.