mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Change semantics of HaveCoinInCache to match HaveCoin
Previously it was possible for HaveCoinInCache to return true for a spent coin. It is more clear to keep the semantics the same. HaveCoinInCache is used for two reasons: - tracking coins we may want to uncache, in which case it is unlikely there would be spent coins we could uncache (not dirty) - optimistically checking whether we have already included a tx in the blockchain, in which case a spent coin is not a reliable indicator that we have.
This commit is contained in:
parent
9c248e39f2
commit
525769853e
@ -124,7 +124,7 @@ bool CCoinsViewCache::HaveCoin(const COutPoint &outpoint) const {
|
||||
|
||||
bool CCoinsViewCache::HaveCoinInCache(const COutPoint &outpoint) const {
|
||||
CCoinsMap::const_iterator it = cacheCoins.find(outpoint);
|
||||
return it != cacheCoins.end();
|
||||
return (it != cacheCoins.end() && !it->second.coin.IsSpent());
|
||||
}
|
||||
|
||||
uint256 CCoinsViewCache::GetBestBlock() const {
|
||||
|
Loading…
Reference in New Issue
Block a user