Chainstate::FlushStateToDisk

Update the on-disk chain state. The caches and indexes are flushed depending on the mode we're called with if they're too large, if it's been a while since the last write, or always and in all cases if we're in prune mode and are deleting files.

Synopsis

Declared in <validation.h>

bool
FlushStateToDisk(
    BlockValidationState& state,
    FlushStateMode mode,
    int nManualPruneHeight = 0);

Description

If FlushStateMode::NONE is used, then FlushStateToDisk(...) won't do anything besides checking if we need to prune.

Return Value

true unless a system error occurred

Parameters

NameDescription
state [in]Validation state updated if a system error occurs.
mode [in]How aggressively to flush the caches to disk.
nManualPruneHeight [in]Height up to which to manually prune, or 0 for none.