refactor: reuse should_empty for chainstate flush condition #34125

pull l0rinc wants to merge 2 commits into bitcoin:master from l0rinc:l0rinc/reuse-should-empty changing 9 files +47 −52
  1. l0rinc commented at 12:14 pm on December 20, 2025: contributor
    minor follow-up to #33866 (included here). Drafted until that’s merged.
  2. refactor: Let CCoinsViewCache::BatchWrite return void
    CCoinsViewCache::BatchWrite always returns true if called from a backed
    cache, so just return void instead. Also return void from ::Sync and
    ::Flush.
    
    This allows for dropping a FatalError condition and simplifying some
    dead error handling code a bit.
    
    Since we now no longer exercise the "error path" when returning from
    `CCoinsView::BatchWrite`, make the method clear the cache instead. This
    should only be exercised by tests and not change production behaviour.
    This might slightly improve the coins_view fuzz test's ability to
    generate better coverage.
    
    Co-authored-by: l0rinc <pap.lorinc@gmail.com>
    b70921edec
  3. refactor: reuse `should_empty` for chainstate flush condition bd0c5cf622
  4. DrahtBot added the label Refactoring on Dec 20, 2025
  5. 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:

    • #34164 (validation: add reusable coins view for ConnectBlock by andrewtoth)
    • #34124 (refactor: make CCoinsView a purely virtual abstract base class by l0rinc)
    • #33866 (refactor: Let CCoinsViewCache::BatchWrite return void by sedited)
    • #33680 (validation: do not wipe utxo cache for stats/scans/snapshots by l0rinc)
    • #33512 (coins: use number of dirty cache entries in flush warnings/logs by l0rinc)
    • #31132 (validation: fetch block inputs on parallel threads 3x faster IBD by andrewtoth)

    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.


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-02 00:13 UTC

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