22#include <validation.h>
33 hashBlock(block_hash) {}
90 for (
auto it = outputs.begin(); it != outputs.end(); ++it) {
92 Coin coin = it->second;
101 for (
auto it = outputs.begin(); it != outputs.end(); ++it) {
114 std::unique_ptr<CCoinsViewCursor> pcursor;
118 pcursor =
view.Cursor();
119 pindex =
blockman.LookupBlockIndex(pcursor->GetBestBlock());
124 std::map<uint32_t, Coin> outputs;
125 while (pcursor->Valid()) {
129 if (pcursor->GetKey(key) && pcursor->GetValue(coin)) {
136 outputs[key.
n] = std::move(coin);
144 if (!outputs.empty()) {
151 stats.nDiskSize =
view.EstimateSize();
157 return [&]() -> std::optional<CCoinsStats> {
#define Assert(val)
Identity function.
The block chain is a tree shaped structure starting with the genesis block at the root,...
uint256 GetBlockHash() const
CCoinsView backed by the coin database (chainstate/)
An outpoint - a combination of a transaction hash and an index n into its vout.
Serialized script, used inside transaction inputs and outputs.
CTxOut out
unspent transaction output
bool fCoinBase
whether containing transaction was a coinbase
uint32_t nHeight
at which height this containing transaction was included in the active block chain
Double ended buffer combining vector and stream-like interfaces.
A writer stream (for serialization) that computes a 256-bit hash.
A class representing MuHash sets.
void Finalize(uint256 &out) noexcept
MuHash3072 & Insert(std::span< const unsigned char > in) noexcept
MuHash3072 & Remove(std::span< const unsigned char > in) noexcept
Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most-w...
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
#define T(expected, seed, data)
#define LogDebug(category,...)
static void FinalizeHash(HashWriter &ss, CCoinsStats &stats)
static std::optional< CCoinsStats > ComputeUTXOStats(T hash_obj, const CCoinsViewDB &view, node::BlockManager &blockman, const std::function< void()> &interruption_point)
Calculate statistics about the unspent transaction output set.
static void ApplyStats(CCoinsStats &stats, const std::map< uint32_t, Coin > &outputs)
void RemoveCoinHash(MuHash3072 &muhash, const COutPoint &outpoint, const Coin &coin)
static void ApplyCoinHash(HashWriter &ss, const COutPoint &outpoint, const Coin &coin)
static void ApplyHash(T &hash_obj, const Txid &hash, const std::map< uint32_t, Coin > &outputs)
Warning: be very careful when changing this! assumeutxo and UTXO snapshot validation commitments are ...
uint64_t GetBogoSize(const CScript &script_pub_key)
static void TxOutSer(T &ss, const COutPoint &outpoint, const Coin &coin)
std::optional< T > CheckedAdd(const T i, const T j) noexcept
constexpr auto MakeUCharSpan(const V &v) -> decltype(UCharSpanCast(std::span{v}))
Like the std::span constructor, but for (const) unsigned char member types only.
std::optional< CAmount > total_amount
The total amount, or nullopt if an overflow occurred calculating it.
uint64_t nTransactionOutputs
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.