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.
This commit is contained in:
Matt Corallo
2017-06-05 11:50:47 -04:00
parent ec1271f2be
commit 3533fb4d33
3 changed files with 8 additions and 6 deletions

View File

@@ -91,9 +91,9 @@ void AddCoins(CCoinsViewCache& cache, const CTransaction &tx, int nHeight) {
}
}
void CCoinsViewCache::SpendCoin(const COutPoint &outpoint, Coin* moveout) {
bool CCoinsViewCache::SpendCoin(const COutPoint &outpoint, Coin* moveout) {
CCoinsMap::iterator it = FetchCoin(outpoint);
if (it == cacheCoins.end()) return;
if (it == cacheCoins.end()) return false;
cachedCoinsUsage -= it->second.coin.DynamicMemoryUsage();
if (moveout) {
*moveout = std::move(it->second.coin);
@@ -104,6 +104,7 @@ void CCoinsViewCache::SpendCoin(const COutPoint &outpoint, Coin* moveout) {
it->second.flags |= CCoinsCacheEntry::DIRTY;
it->second.coin.Clear();
}
return true;
}
static const Coin coinEmpty;