Aims to solve #32600. Found it while working on #26966 (this was really annoying there).
This ensures the node is index-synced before perturbing files. If the index sync gets interrupted before it starts, the database could be empty, making any following perturbation ineffective (which explains why the node does not abort during startup in the #32600 logs).
Also, the first commit avoids initializing components not under test. This reduces log flooding, which helped in understanding the issue.
Patch to reproduce the issue on master using feature_init.py
(this simulates
a node shutting down before the index starts syncing):
0diff --git a/src/index/base.cpp b/src/index/base.cpp
1--- a/src/index/base.cpp (revision 1e03052c3fefb188f047e72548f2c6b0cc019e50)
2+++ b/src/index/base.cpp (date 1751293306725)
3@@ -185,6 +185,7 @@
4 void BaseIndex::Sync()
5 {
6 const CBlockIndex* pindex = m_best_block_index.load();
7+ m_interrupt();
8 if (!m_synced) {
9 std::chrono::steady_clock::time_point last_log_time{0s};
10 std::chrono::steady_clock::time_point last_locator_write_time{0s};