Skip to content

Commit 4a6d1d1

Browse files
committed
validation: don't clear cache on periodic flush
1 parent c8e3978 commit 4a6d1d1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/validation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2745,8 +2745,10 @@ bool Chainstate::FlushStateToDisk(
27452745
return FatalError(m_chainman.GetNotifications(), state, _("Disk space is too low!"));
27462746
}
27472747
// Flush the chainstate (which may refer to block index entries).
2748-
if (!CoinsTip().Flush())
2748+
const auto empty_cache{(mode == FlushStateMode::ALWAYS) || fCacheLarge || fCacheCritical || fFlushForPrune};
2749+
if (empty_cache ? !CoinsTip().Flush() : !CoinsTip().Sync()) {
27492750
return FatalError(m_chainman.GetNotifications(), state, _("Failed to write to coin database."));
2751+
}
27502752
m_last_flush = nNow;
27512753
full_flush_completed = true;
27522754
TRACE5(utxocache, flush,

0 commit comments

Comments
 (0)