Minor follow-up to #33866
Reuse the should_empty predicate for both the write decision and for selecting CoinsTip().Flush() vs CoinsTip().Sync().
This is a pure refactor, no behavior is changed.
should_empty check for chainstate flush
#34125
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34125.
See the guideline for information on the review process. A summary of reviews will appear here.
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
In `Chainstate::FlushStateToDisk`, the condition for emptying the UTXO cache was duplicated: once in `should_write` and again when choosing between `CoinsTip().Flush()` and `CoinsTip().Sync()`.
Compute it once as `should_empty` and reuse it in both places.
Labels
Refactoring