validation: do not wipe utxo cache for stats/scans/snapshots

Since #28280, the cost of a non-wiping sync of the UTXO cache is only proportional to the number of dirty entries, rather than proportional to the size of the entire cache. Because of that, there is no reason to perform a wiping flush in case the contents of the cache is still useful.

Split the FlushStateMode::ALWAYS mode into a FORCE_SYNC (non-wiping) and a FORCE_FLUSH (wiping), and then use the former in scantxoutset, gettxoutsetinfo, snapshot creation.

Co-authored-by: l0rinc <pap.lorinc@gmail.com>
Co-authored-by: cedwies <141683552+cedwies@users.noreply.github.com>
This commit is contained in:
Pieter Wuille
2024-08-08 09:56:53 -04:00
committed by Lőrinc
parent 7099e93d0a
commit c6ca2b85a3
8 changed files with 20 additions and 17 deletions

View File

@@ -46,6 +46,7 @@ FLUSH_MODES = [
'IF_NEEDED',
'PERIODIC',
'FORCE_FLUSH',
'FORCE_SYNC',
]