Skip to content

Pruned node with blockfilterindex or coinstatsindex crashes when assumeutxo background validation completes (v32.1) #36939

Description

@paulscode

Current behaviour

A pruned node with -blockfilterindex=1 or -coinstatsindex=1 that loads a snapshot with loadtxoutset stops with a fatal error as soon as background validation reaches the snapshot base:

[snapshot] snapshot beginning at 0000000000d9877342754dea8ec1eb24631517d38e3443c370465ee53a8b7434 has been fully validated
[snapshot] restarting indexes
[error] Failed for FlatFilePos(nFile=-1, nPos=0) while reading raw block storage header
[error] A fatal internal error occurred, see debug.log for details: Failed to read block 000000000803a2f5f0004ed4088b37c9eae9752c8522f7fbc13e3f70496cc831 from disk

Every later start refuses with Index "..." needs block data that has been pruned. The node only comes back with the index disabled, and the index can then only be rebuilt with a full reindex.

Expected behaviour

The node keeps running after background validation and the index continues from where it was.

Steps to reproduce

  1. testnet4, -prune=550 -blockfilterindex=1 -dbcache=4000 -assumevalid=0 (also happens with -coinstatsindex=1 instead).
  2. Wait for headers past 150000, then loadtxoutset a snapshot at height 150000 (made with dumptxoutset <path> rollback on another v32.1 node).
  3. Wait for background validation to finish (about 75 minutes here).

Reproduced once with each index. In both runs the node died within seconds of the "fully validated" line.

What seems to happen

While the background chainstate syncs, every flush logs

[warning] Locator contains block (hash=...) not on known best chain (tip=...); not writing index locator

with the index exactly one block behind the flushed locator (for example locator at 51496, index at 51495; the last one 150000 vs 149999). This happened 85 to 89 times per run, so the index's saved locator never moves forward after its initial sync. The prune lock follows the index's in-memory height, so blocks above the saved locator get pruned. When the indexes restart after validation they start again from the saved locator (height 2996 for blockfilterindex, 40679 for coinstatsindex) and need blocks that are gone.

With -debug=coindb there are no "Skipping commit, index is ahead of flushed chainstate" lines, so the new check in Commit() does not seem to be involved. A clean restart in the middle of background validation does not trigger it, presumably because shutdown commits the in-memory state. I did not try an unclean stop.

Version

v32.1.0, x86_64 Linux (Ubuntu 24.04 container).

Activity

  1. added a commit that references this issue on Nov 22, 2026
    edc5264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions