MCPcopy Create free account
hub / github.com/ElementsProject/elements / AddCoins

Function AddCoins

src/coins.cpp:128–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128void AddCoins(CCoinsViewCache& cache, const CTransaction &tx, int nHeight, bool check_for_overwrite) {
129 bool fCoinbase = tx.IsCoinBase();
130 const uint256& txid = tx.GetHash();
131 for (size_t i = 0; i < tx.vout.size(); ++i) {
132 bool overwrite = check_for_overwrite ? cache.HaveCoin(COutPoint(txid, i)) : fCoinbase;
133 // Coinbase transactions can always be overwritten, in order to correctly
134 // deal with the pre-BIP30 occurrences of duplicate coinbase transactions.
135 cache.AddCoin(COutPoint(txid, i), Coin(tx.vout[i], nHeight, fCoinbase), overwrite);
136 }
137}
138
139bool CCoinsViewCache::SpendCoin(const COutPoint &outpoint, Coin* moveout) {
140 CCoinsMap::iterator it = FetchCoin(outpoint);

Callers 10

checkMethod · 0.85
UpdateCoinsFunction · 0.85
ConnectBlockMethod · 0.85
RollforwardBlockMethod · 0.85
BuildTxsFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
FUZZ_TARGET_INITFunction · 0.85
SetupDummyInputsFunction · 0.85

Calls 7

AddCoinMethod · 0.80
CoinClass · 0.70
COutPointClass · 0.50
IsCoinBaseMethod · 0.45
GetHashMethod · 0.45
sizeMethod · 0.45
HaveCoinMethod · 0.45

Tested by 6

BuildTxsFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68
SetupDummyInputsFunction · 0.68