mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-18 19:40:40 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user