0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

validation: don't clear cache on periodic flush

This commit is contained in:
Andrew Toth 2023-08-17 16:17:18 -04:00
parent c8e3978114
commit 4a6d1d1e3b
No known key found for this signature in database
GPG key ID: 60007AFC8938B018

View file

@ -2745,8 +2745,10 @@ bool Chainstate::FlushStateToDisk(
return FatalError(m_chainman.GetNotifications(), state, _("Disk space is too low!")); return FatalError(m_chainman.GetNotifications(), state, _("Disk space is too low!"));
} }
// Flush the chainstate (which may refer to block index entries). // Flush the chainstate (which may refer to block index entries).
if (!CoinsTip().Flush()) const auto empty_cache{(mode == FlushStateMode::ALWAYS) || fCacheLarge || fCacheCritical || fFlushForPrune};
if (empty_cache ? !CoinsTip().Flush() : !CoinsTip().Sync()) {
return FatalError(m_chainman.GetNotifications(), state, _("Failed to write to coin database.")); return FatalError(m_chainman.GetNotifications(), state, _("Failed to write to coin database."));
}
m_last_flush = nNow; m_last_flush = nNow;
full_flush_completed = true; full_flush_completed = true;
TRACE5(utxocache, flush, TRACE5(utxocache, flush,