[#Chainstate-FlushStateToDisk]
= xref:Chainstate.adoc[Chainstate]::FlushStateToDisk
:relfileprefix: ../
:mrdocs:

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

== Synopsis

Declared in `&lt;validation&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
bool
FlushStateToDisk(
    xref:BlockValidationState.adoc[BlockValidationState]& state,
    xref:FlushStateMode.adoc[FlushStateMode] mode,
    int nManualPruneHeight = 0);
----

== Description

If FlushStateMode&colon;&colon;NONE is used, then FlushStateToDisk(&period;&period;&period;) won&apos;t do anything besides checking if we need to prune&period;

== Return Value

true unless a system error occurred

== Parameters

[cols="1,4"]
|===
| Name| Description
| *state* [in]
| Validation state updated if a system error occurs&period;
| *mode* [in]
| How aggressively to flush the caches to disk&period;
| *nManualPruneHeight* [in]
| Height up to which to manually prune, or 0 for none&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
