log: print reason for why should_write was triggered in FlushStateToDisk

Co-authored-by: Jon Atack <jon@atack.com>
This commit is contained in:
Lőrinc
2025-05-02 15:46:45 +02:00
parent 2df824f4e6
commit 53e9b71b2f
2 changed files with 5 additions and 1 deletions

View File

@@ -2874,6 +2874,9 @@ bool Chainstate::FlushStateToDisk(
bool should_write = (mode == FlushStateMode::ALWAYS) || fCacheLarge || fCacheCritical || fPeriodicWrite || fFlushForPrune;
// Write blocks, block index and best chain related state to disk.
if (should_write) {
LogDebug(BCLog::COINDB, "Writing chainstate to disk: flush mode=%s, prune=%d, large=%d, critical=%d, periodic=%d",
FlushStateModeNames[size_t(mode)], fFlushForPrune, fCacheLarge, fCacheCritical, fPeriodicWrite);
// Ensure we can write block index
if (!CheckDiskSpace(m_blockman.m_opts.blocks_dir)) {
return FatalError(m_chainman.GetNotifications(), state, _("Disk space is too low!"));