Bitcoin
Functions | Variables
coins.cpp File Reference
#include <coins.h>
#include <consensus/consensus.h>
#include <random.h>
#include <version.h>

Functions

void AddCoins (CCoinsViewCache &cache, const CTransaction &tx, int nHeight, bool check)
 
const CoinAccessByTxid (const CCoinsViewCache &view, const uint256 &txid)
 

Variables

static const Coin coinEmpty
 
static const size_t MIN_TRANSACTION_OUTPUT_WEIGHT = WITNESS_SCALE_FACTOR * ::GetSerializeSize(CTxOut(), PROTOCOL_VERSION)
 
static const size_t MAX_OUTPUTS_PER_BLOCK = MAX_BLOCK_WEIGHT / MIN_TRANSACTION_OUTPUT_WEIGHT
 

Function Documentation

◆ AccessByTxid()

const Coin& AccessByTxid ( const CCoinsViewCache cache,
const uint256 txid 
)

Utility function to find any unspent output with a given txid. This function can be quite expensive because in the event of a transaction which is not found in the cache, it can cause up to MAX_OUTPUTS_PER_BLOCK lookups to database, so it should be used with care.

◆ AddCoins()

void AddCoins ( CCoinsViewCache cache,
const CTransaction tx,
int  nHeight,
bool  check = false 
)

Utility function to add all of a transaction's outputs to a cache. When check is false, this assumes that overwrites are only possible for coinbase transactions. When check is true, the underlying view may be queried to determine whether an addition is an overwrite.

Variable Documentation

◆ coinEmpty

const Coin coinEmpty
static

◆ MAX_OUTPUTS_PER_BLOCK

const size_t MAX_OUTPUTS_PER_BLOCK = MAX_BLOCK_WEIGHT / MIN_TRANSACTION_OUTPUT_WEIGHT
static

◆ MIN_TRANSACTION_OUTPUT_WEIGHT

const size_t MIN_TRANSACTION_OUTPUT_WEIGHT = WITNESS_SCALE_FACTOR * ::GetSerializeSize(CTxOut(), PROTOCOL_VERSION)
static