mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-29 18:05:58 +02:00
log: print reason for why should_write was triggered in FlushStateToDisk
Co-authored-by: Jon Atack <jon@atack.com>
This commit is contained in:
@@ -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!"));
|
||||
|
||||
@@ -437,7 +437,8 @@ enum DisconnectResult
|
||||
class ConnectTrace;
|
||||
|
||||
/** @see Chainstate::FlushStateToDisk */
|
||||
enum class FlushStateMode {
|
||||
inline constexpr std::array FlushStateModeNames{"NONE", "IF_NEEDED", "PERIODIC", "ALWAYS"};
|
||||
enum class FlushStateMode: uint8_t {
|
||||
NONE,
|
||||
IF_NEEDED,
|
||||
PERIODIC,
|
||||
|
||||
Reference in New Issue
Block a user