| 2003 | } |
| 2004 | |
| 2005 | void 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 | |
| 2020 | std::optional<std::pair<ScriptError, std::string>> CScriptCheck::operator()() { |
| 2021 | const CScript &scriptSig = ptxTo->vin[nIn].scriptSig; |