aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorPieter Wuille <[email protected]>2017-06-20 18:18:09 -0700
committerPieter Wuille <[email protected]>2017-06-20 18:27:45 -0700
commitb3eb0d6485510f2bdf36d256ab60ce29b8213744 (patch)
treed74e67230ffbe2f00eadc0834e642636abec6611 /src/validation.cpp
parentMerge #10503: Use REJECT_DUPLICATE for already known and conflicted txn (diff)
parentBe much more agressive in AccessCoin docs. (diff)
downloaddiscoin-b3eb0d6485510f2bdf36d256ab60ce29b8213744.tar.xz
discoin-b3eb0d6485510f2bdf36d256ab60ce29b8213744.zip
Merge #10537: Few Minor per-utxo assert-semantics re-adds and tweak
9417d7a33 Be much more agressive in AccessCoin docs. (Matt Corallo) f58349ca8 Restore some assert semantics in sigop cost calculations (Matt Corallo) 3533fb4d3 Return a bool in SpendCoin to restore pre-per-utxo assert semantics (Matt Corallo) ec1271f2b Remove useless mapNextTx lookup in CTxMemPool::TrimToSize. (Matt Corallo) Tree-SHA512: 158a4bce063eac93e1d50709500a10a7cb1fb3271f10ed445d701852fce713e2bf0da3456088e530ab005f194ef4a2adf0c7cb23226b160cecb37a79561f29ca
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 4df5234df..cba3b9e4a 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1125,7 +1125,8 @@ void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txund
txundo.vprevout.reserve(tx.vin.size());
for (const CTxIn &txin : tx.vin) {
txundo.vprevout.emplace_back();
- inputs.SpendCoin(txin.prevout, &txundo.vprevout.back());
+ bool is_spent = inputs.SpendCoin(txin.prevout, &txundo.vprevout.back());
+ assert(is_spent);
}
}
// add outputs
@@ -1370,8 +1371,8 @@ static DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex*
if (!tx.vout[o].scriptPubKey.IsUnspendable()) {
COutPoint out(hash, o);
Coin coin;
- view.SpendCoin(out, &coin);
- if (tx.vout[o] != coin.out) {
+ bool is_spent = view.SpendCoin(out, &coin);
+ if (!is_spent || tx.vout[o] != coin.out) {
fClean = false; // transaction output mismatch
}
}