aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/validation.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index c2b56555a2..609ccec153 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -2748,8 +2748,10 @@ bool Chainstate::FlushStateToDisk(
return FatalError(m_chainman.GetNotifications(), state, _("Disk space is too low!"));
}
// 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."));
+ }
m_last_flush = nNow;
full_flush_completed = true;
TRACE5(utxocache, flush,