diff options
author | Matt Corallo <git@bluematt.me> | 2017-06-05 11:50:47 -0400 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2017-06-09 13:10:05 -0400 |
commit | 3533fb4d33ecc94a789cb5d4489da22a68fb2168 (patch) | |
tree | d4210584798f80828e4a133bb3d72944cf6a414a /src/validation.cpp | |
parent | ec1271f2bea52d43bd24fb93d32d24168f8c6a74 (diff) |
Return a bool in SpendCoin to restore pre-per-utxo assert semantics
Since its free to do so, assert that Spends succeeded when we expect
them to.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index de65839eef..c708a476de 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1118,7 +1118,8 @@ void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txund txundo.vprevout.reserve(tx.vin.size()); BOOST_FOREACH(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 @@ -1358,8 +1359,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 } } |