From b557fa7a175f139614932fbb3a4ad0af8271c73c Mon Sep 17 00:00:00 2001 From: Andrew Toth Date: Sat, 31 Aug 2024 11:14:18 -0400 Subject: [PATCH] refactor: rename fDoFullFlush to should_write --- src/validation.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index 01722e70ec2..12e28cbbfbf 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2831,7 +2831,6 @@ bool Chainstate::FlushStateToDisk( try { { bool fFlushForPrune = false; - bool fDoFullFlush = false; CoinsCacheSizeState cache_state = GetCoinsCacheSizeState(); LOCK(m_blockman.cs_LastBlockFile); @@ -2887,10 +2886,10 @@ bool Chainstate::FlushStateToDisk( bool fCacheCritical = mode == FlushStateMode::IF_NEEDED && cache_state >= CoinsCacheSizeState::CRITICAL; // It's been a while since we wrote the block index and chain state to disk. Do this frequently, so we don't need to redownload or reindex after a crash. bool fPeriodicWrite = mode == FlushStateMode::PERIODIC && nNow > m_last_write + DATABASE_WRITE_INTERVAL; - // Combine all conditions that result in a full cache flush. - fDoFullFlush = (mode == FlushStateMode::ALWAYS) || fCacheLarge || fCacheCritical || fPeriodicWrite || fFlushForPrune; + // Combine all conditions that result in a write to disk. + bool should_write = (mode == FlushStateMode::ALWAYS) || fCacheLarge || fCacheCritical || fPeriodicWrite || fFlushForPrune; // Write blocks, block index and best chain related state to disk. - if (fDoFullFlush) { + if (should_write) { // 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!"));