MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / UpdateCoins

Function UpdateCoins

src/validation.cpp:2005–2018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2003}
2004
2005void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txundo, int nHeight)
2006{
2007 // mark inputs spent
2008 if (!tx.IsCoinBase()) {
2009 txundo.vprevout.reserve(tx.vin.size());
2010 for (const CTxIn &txin : tx.vin) {
2011 txundo.vprevout.emplace_back();
2012 bool is_spent = inputs.SpendCoin(txin.prevout, &txundo.vprevout.back());
2013 assert(is_spent);
2014 }
2015 }
2016 // add outputs
2017 AddCoins(inputs, tx, nHeight);
2018}
2019
2020std::optional<std::pair<ScriptError, std::string>> CScriptCheck::operator()() {
2021 const CScript &scriptSig = ptxTo->vin[nIn].scriptSig;

Callers 2

ConnectBlockMethod · 0.85
BOOST_FIXTURE_TEST_CASEFunction · 0.85

Calls 7

SpendCoinMethod · 0.80
AddCoinsFunction · 0.70
IsCoinBaseMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45
backMethod · 0.45

Tested by 1

BOOST_FIXTURE_TEST_CASEFunction · 0.68