test: make index crash test check saved state #36059

pull l0rinc wants to merge 2 commits into bitcoin:master from l0rinc:l0rinc/test-preserve-index-crash-state changing 1 files +7 −2
  1. l0rinc commented at 3:48 AM on August 23, 2026: contributor

    Problem: #35847 moved the unclean-shutdown test into the shared base index tests, but it checked only that each index could reopen and start background sync. Both checks also pass when the index reopens at height 0, so they do not verify that a height-100 checkpoint was saved before the simulated crash and reloaded afterward.

    Fix: The first commit records the existing false positive by asserting that each index reopens at height 0 before background sync. The second commit establishes a durable checkpoint at height 100, drains its setup notification, and changes the same assertion to the pre-crash height.

  2. test: expose missing index crash checkpoint
    `index_unclean_shutdown` previously checked only that each index could reopen and start background sync after the simulated crash.
    An empty index at height 0 satisfies both checks, so the test could pass without preserving any pre-crash checkpoint.
    
    Assert the current reopened height before background sync to make the false positive explicit.
    5aa15df60c
  3. test: preserve index crash test state
    Flush the chainstate at the current tip and drain its notification before registering any index.
    This lets each end-of-sync `Commit()` persist the pre-crash height and keeps the setup callback out of the simulated crash window.
    
    Replace the TODO-marked `0` expectation with the captured tip height.
    The check runs before background sync, so rebuilding cannot hide a missing checkpoint.
    7ea36e985a
  4. DrahtBot added the label Tests on Aug 23, 2026
  5. DrahtBot commented at 3:48 AM on August 23, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK jeanpablojp

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  6. jeanpablojp commented at 8:34 PM on August 23, 2026: contributor

    tACK 7ea36e985a900b2291ce549e468f6baab5324dc6

    Good catch. Built and ran the tests, nothing else came up.


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-08-23 23:50 UTC

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