Review report

core: PR #24230

๐ŸŸ  Major

Bound index commits to a durable chainstate point (src/index/base.cpp:222, head)

The ancestry check in IgnoreChainStateFlushed proves only that the notification locator is an ancestor of the index best block, not that the best block is durable. DisconnectTip may flush the rolled-back chainstate before queuing BlockDisconnected, allowing this callback to commit the stale index tip before the index processes the rewind. Also, node::MakeBlockInfo treats a null last-flushed block as FLUSHED, permitting periodic commits when no flush point exists. For stateful indexes such as coinstatsindex, a crash can leave persisted index state ahead of recoverable chainstate and potentially require an index rebuild. Bound commits to a known flushed block, and do not treat a missing flush point as proof that blocks are flushed.

๐ŸŸก Minor

Do not assert that the best-block marker reaches the reorg fork (src/index/base.cpp:121, head)

During SYNCING, m_best_block is intentionally not advanced for every appended block. A reorg above the last commit can therefore leave this marker below the replacement block's parent, even after the stale indexed blocks have been disconnected. Then findAncestorByHeight(best_block->hash, block.height - 1, ...) returns false, and this assertion aborts an assertion-enabled node on a valid reorg. Base the check on the actual sync or reorg cursor, or allow the marker to be below the fork point before advancing it.

Handle sync completion at genesis without dereferencing a null parent (src/index/base.cpp:119, head)

A valid rollback to genesis can leave m_rewind_start set after the disconnected blocks are removed. SyncChain then sends a data-less completion notification for genesis; MakeBlockInfo provides no prev_hash for genesis, so this dereference crashes the node. Distinguish the completion notification from a newly connected block before using its parent hash.

Wait for an in-flight sync-registration callback before stopping the index (src/node/interfaces.cpp:542, head)

A queued callback can pass connect() and pause before invoking blockConnected. Concurrent disconnect() can unregister the proxy, reset the handler's proxy reference, and return without waiting for the callback; Stop() joins the sync thread but not the validation-queue callback. The callback's captured proxy keeps the notification object alive, but that object holds a reference to BaseIndex. Destroying the index after Stop() can therefore leave the callback calling into freed memory. Make disconnection wait for an in-flight registration callback, or otherwise ensure the index outlives it.

Review coverage was incomplete. The adversarial review did not complete. The adversarial_glm review did not complete.