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.
`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.
This adds a factory that returns each index type and runs the test
in a loop against all indexes.
index_reorg_crash is left as a single test since it uses a bespoke index.
This is in preparation for the following commit, where the
baseindex tests are executed for multiple indexes.
Since each run increases the chain, make no absolute assumptions.
It tests generic functionality, nothing specific to the
coinststatsindex.
Mostly move-only, can be reviewed with
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
It tests generic functionality, nothing specific to the
blockfilterindex.
Mostly move-only, can be reviewed with
--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
Otherwise, if the node has an unclean restart,
indexes with state (coinstatsindex) couldn't reorg to the
last flushed tip and would be corrupted.
Also updates documentation of Commit() -
the locator functionality isn't used, so the previous text was wrong:
We must have the best block in our block index after a restart.
Co-authored-by: Fabian Jahr <fjahr@protonmail.com>