mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Add method to remove a tx from CCoinsViewCache if it is unchanged
This commit is contained in:
@@ -206,6 +206,15 @@ bool CCoinsViewCache::Flush() {
|
||||
return fOk;
|
||||
}
|
||||
|
||||
void CCoinsViewCache::Uncache(const uint256& hash)
|
||||
{
|
||||
CCoinsMap::iterator it = cacheCoins.find(hash);
|
||||
if (it != cacheCoins.end() && it->second.flags == 0) {
|
||||
cachedCoinsUsage -= it->second.coins.DynamicMemoryUsage();
|
||||
cacheCoins.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int CCoinsViewCache::GetCacheSize() const {
|
||||
return cacheCoins.size();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user