mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-17 13:40:43 +02:00
Add assertions that BatchWrite(erase=true) erases
This commit is contained in:
parent
941feb6ca2
commit
2e16054a66
@ -250,7 +250,10 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlockIn
|
|||||||
|
|
||||||
bool CCoinsViewCache::Flush() {
|
bool CCoinsViewCache::Flush() {
|
||||||
bool fOk = base->BatchWrite(cacheCoins, hashBlock, /*erase=*/true);
|
bool fOk = base->BatchWrite(cacheCoins, hashBlock, /*erase=*/true);
|
||||||
cacheCoins.clear();
|
if (fOk && !cacheCoins.empty()) {
|
||||||
|
/* BatchWrite must erase all cacheCoins elements when erase=true. */
|
||||||
|
throw std::logic_error("Not all cached coins were erased");
|
||||||
|
}
|
||||||
cachedCoinsUsage = 0;
|
cachedCoinsUsage = 0;
|
||||||
return fOk;
|
return fOk;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user