Bitcoin Core  22.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 <index/coinstatsindex.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

uint64_t GetBogoSize (const CScript &script_pub_key)
 
CDataStream TxOutSer (const COutPoint &outpoint, const Coin &coin)
 
static void ApplyHash (CHashWriter &ss, 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...
 
static void ApplyHash (std::nullptr_t, const uint256 &hash, const std::map< uint32_t, Coin > &outputs)
 
static void ApplyHash (MuHash3072 &muhash, const uint256 &hash, const std::map< uint32_t, Coin > &outputs)
 
static void ApplyStats (CCoinsStats &stats, const uint256 &hash, const std::map< uint32_t, Coin > &outputs)
 
template<typename T >
static bool GetUTXOStats (CCoinsView *view, BlockManager &blockman, CCoinsStats &stats, T hash_obj, const std::function< void()> &interruption_point, const CBlockIndex *pindex)
 Calculate statistics about the unspent transaction output set. More...
 
bool GetUTXOStats (CCoinsView *view, BlockManager &blockman, CCoinsStats &stats, const std::function< void()> &interruption_point, const CBlockIndex *pindex)
 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 ( CHashWriter ss,
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 50 of file coinstats.cpp.

Here is the caller graph for this function:

◆ ApplyHash() [2/3]

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

Definition at line 70 of file coinstats.cpp.

Here is the call graph for this function:

◆ ApplyHash() [3/3]

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

Definition at line 68 of file coinstats.cpp.

◆ ApplyStats()

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

Definition at line 79 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 172 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 176 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 182 of file coinstats.cpp.

◆ GetBogoSize()

uint64_t GetBogoSize ( const CScript script_pub_key)

Definition at line 20 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,
const std::function< void()> &  interruption_point,
const CBlockIndex pindex 
)

Calculate statistics about the unspent transaction output set.

Definition at line 145 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,
T  hash_obj,
const std::function< void()> &  interruption_point,
const CBlockIndex pindex 
)
static

Calculate statistics about the unspent transaction output set.

Definition at line 92 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 164 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 169 of file coinstats.cpp.

◆ PrepareHash() [3/3]

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

Definition at line 170 of file coinstats.cpp.

◆ TxOutSer()

CDataStream TxOutSer ( const COutPoint outpoint,
const Coin coin 
)

Definition at line 30 of file coinstats.cpp.

Here is the caller graph for this function: