mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-18 19:40:40 +01:00
Simplify return values of GetCoin/HaveCoin(InCache)
This removes the possibility for GetCoin/HaveCoin/HaveCoinInCache to return true while the respective coin is spent. By doing it across all calls, some extra checks can be eliminated. coins_tests is modified to call HaveCoin sometimes before and sometimes after AccessCoin. A further change is needed because the semantics for GetCoin slightly changed, causing a pruned entry in the parent cache to not be pulled into the child in FetchCoin.
This commit is contained in:
@@ -903,11 +903,7 @@ bool CCoinsViewMemPool::GetCoin(const COutPoint &outpoint, Coin &coin) const {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (base->GetCoin(outpoint, coin) && !coin.IsSpent());
|
||||
}
|
||||
|
||||
bool CCoinsViewMemPool::HaveCoin(const COutPoint &outpoint) const {
|
||||
return mempool.exists(outpoint) || base->HaveCoin(outpoint);
|
||||
return base->GetCoin(outpoint, coin);
|
||||
}
|
||||
|
||||
size_t CTxMemPool::DynamicMemoryUsage() const {
|
||||
|
||||
Reference in New Issue
Block a user