MCPcopy Create free account
hub / github.com/LUX-Core/lux / UpdateCoins

Function UpdateCoins

src/main.cpp:2185–2210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2183}
2184
2185void UpdateCoins(const CTransaction& tx, CValidationState& state, CCoinsViewCache& inputs, CTxUndo& txundo, int nHeight)
2186{
2187 // mark inputs spent
2188 if (!tx.IsCoinBase()) {
2189 txundo.vprevout.reserve(tx.vin.size());
2190 for (const CTxIn &txin : tx.vin) {
2191 CCoinsModifier coins = inputs.ModifyCoins(txin.prevout.hash);
2192 unsigned nPos = txin.prevout.n;
2193
2194 if (nPos >= coins->vout.size() || coins->vout[nPos].IsNull())
2195 assert(false);
2196 // mark an outpoint spent, and construct undo information
2197 txundo.vprevout.push_back(CTxInUndo(coins->vout[nPos]));
2198 coins->Spend(nPos);
2199 if (coins->vout.size() == 0) {
2200 CTxInUndo &undo = txundo.vprevout.back();
2201 undo.nHeight = coins->nHeight;
2202 undo.fCoinBase = coins->fCoinBase;
2203 undo.fCoinStake = coins->fCoinStake;
2204 undo.nVersion = coins->nVersion;
2205 }
2206 }
2207 }
2208 // add outputs
2209 inputs.ModifyNewCoins(tx.GetHash(), tx.IsCoinBase())->FromTx(tx,nHeight);
2210}
2211
2212void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, int nHeight)
2213{

Callers 2

checkMethod · 0.85
ConnectBlockFunction · 0.85

Calls 12

CTxInUndoClass · 0.85
ModifyCoinsMethod · 0.80
SpendMethod · 0.80
backMethod · 0.80
ModifyNewCoinsMethod · 0.80
IsCoinBaseMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
IsNullMethod · 0.45
push_backMethod · 0.45
FromTxMethod · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected