HomePhabricator

index: don't commit state in BaseIndex::Rewind

Description

index: don't commit state in BaseIndex::Rewind

Summary:
The committed state of an index should never
be ahead of the flushed chainstate. Otherwise, in the case
of an unclean shutdown, the blocks necessary to revert
from the prematurely committed state would not be
available, which would corrupt the coinstatsindex in particular.
Instead, the index state will be committed with the next
ChainStateFlushed notification.

Test index with an unclean restart after a reorg

This is a backport of core#33212
and partial backport of core#32069 (for TestNode.kill_process)
and partial backport of https://github.com/bitcoin/bitcoin/pull/26606/commits/0b753156ce60c29efb2386954ba7555ad8f642f5 (for passing a expected_ret_code argument to TestNode.wait_until_stopped)

Depends on D18598

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18599

Details

Provenance
Martin Zumsande <mzumsande@gmail.com>Authored on Aug 18 2025, 19:36
PiRKCommitted on Sep 11 2025, 09:16
PiRKPushed on Sep 11 2025, 09:16
Reviewer
Restricted Project
Differential Revision
D18599: index: don't commit state in BaseIndex::Rewind
Parents
rABC82348583961e: Return EXIT_FAILURE on post-init fatal errors
Branches
Unknown
Tags
Unknown