refactor: reuse should_empty check for chainstate flush #34125

pull l0rinc wants to merge 1 commits into bitcoin:master from l0rinc:l0rinc/reuse-should-empty changing 1 files +8 −4
  1. l0rinc commented at 12:14 pm on December 20, 2025: contributor

    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.

  2. DrahtBot added the label Refactoring on Dec 20, 2025
  3. DrahtBot commented at 12:14 pm on December 20, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34125.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #33680 (validation: do not wipe utxo cache for stats/scans/snapshots by l0rinc)

    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.

  4. DrahtBot added the label Needs rebase on Jan 3, 2026
  5. l0rinc force-pushed on Jan 3, 2026
  6. l0rinc renamed this:
    refactor: reuse `should_empty` for chainstate flush condition
    validation: reuse `should_empty` check for chainstate flush
    on Jan 3, 2026
  7. validation/refactor: reuse `should_empty` for chainstate flush condition
    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.
    66ab897866
  8. l0rinc force-pushed on Jan 3, 2026
  9. l0rinc commented at 10:59 am on January 3, 2026: contributor
    #33866 was just merged, this PR is ready for review.
  10. l0rinc marked this as ready for review on Jan 3, 2026
  11. DrahtBot added the label CI failed on Jan 3, 2026
  12. DrahtBot removed the label Needs rebase on Jan 3, 2026
  13. DrahtBot removed the label CI failed on Jan 3, 2026
  14. l0rinc renamed this:
    validation: reuse `should_empty` check for chainstate flush
    refactor: reuse `should_empty` check for chainstate flush
    on Jan 20, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-22 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me