indexes: set prune lock to genesis before first block #36150

pull andrewtoth wants to merge 1 commits into bitcoin:master from andrewtoth:fix_prune changing 1 files +2 −2
  1. andrewtoth commented at 4:47 PM on September 2, 2026: contributor

    When setting both a new index and prune size and restarting an unpruned node, the node will prune the block store first and then the index will fail to start syncing.

    Fix this by setting the prune lock to 0 if the index does not yet have a best block.

  2. indexes: set prune lock to genesis before first block
    When setting both a new index and prune size and restarting
    an unpruned node, the node will prune the block store first
    and then the index will fail to start syncing.
    
    Fix this by setting the prune lock to 0 if the index does not
    yet have a best block.
    39e4a6bb41
  3. DrahtBot added the label UTXO Db and Indexes on Sep 2, 2026
  4. DrahtBot commented at 4:47 PM on September 2, 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/36150.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    Type Reviewers
    ACK sedited
    Concept ACK l0rinc, mzumsande

    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-->

  5. l0rinc commented at 5:47 PM on September 2, 2026: contributor

    Concept ACK! Since #34897 the locator can lag the in-memory tip while SetBestBlockIndex() still advances the lock on every update, so should we maybe derive the lock from the committed locator instead (initialize in Init(), advance in Commit(), cap at the chain height on reorg, flush and drain before pruneblockchain) and cover it with a prune-mode index test?

  6. andrewtoth commented at 5:51 PM on September 2, 2026: contributor

    Since #34897 the locator can lag the in-memory tip while SetBestBlockIndex() still advances the lock on every update, so should we maybe derive the lock from the committed locator instead (initialize in Init(), advance in Commit(), cap at the chain height on reorg, flush and drain before pruneblockchain) and cover it with a prune-mode index test?

    That seems out of scope for what this is fixing. If you have an unpruned node, and then add both a new index and a prune value to the config and restart, it will break on indexing because it will prune first before syncing the index. This is not about a lagging locator, but startup failing to lock the prune height for an empty index.

  7. mzumsande commented at 3:47 PM on September 3, 2026: contributor

    Concept ACK

  8. sedited approved
  9. sedited commented at 7:05 PM on September 3, 2026: contributor

    ACK 39e4a6bb41749547c983456ce05281ca9eae16fe

  10. DrahtBot requested review from mzumsande on Sep 3, 2026
  11. DrahtBot requested review from l0rinc on Sep 3, 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-09-08 11:51 UTC

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