test: Fix shutdown vptr race in BlockFilterIndexSync bench

This commit is contained in:
MarcoFalke 2026-03-04 20:39:48 +01:00
parent e09b81638b
commit fa79098ce2
No known key found for this signature in database
4 changed files with 4 additions and 16 deletions

View File

@ -53,6 +53,9 @@ static void BlockFilterIndexSync(benchmark::Bench& bench)
IndexSummary summary = filter_index.GetSummary();
assert(summary.synced);
assert(summary.best_block_hash == WITH_LOCK(::cs_main, return test_setup->m_node.chainman->ActiveTip()->GetBlockHash()));
// Shutdown sequence (c.f. Shutdown() in init.cpp)
filter_index.Stop();
});
}

View File

@ -64,14 +64,6 @@ BOOST_FIXTURE_TEST_CASE(coinstatsindex_initial_sync, TestChain100Setup)
BOOST_CHECK(block_index != new_block_index);
// It is not safe to stop and destroy the index until it finishes handling
// the last BlockConnected notification. The BlockUntilSyncedToCurrentChain()
// call above is sufficient to ensure this, but the
// SyncWithValidationInterfaceQueue() call below is also needed to ensure
// TSAN always sees the test thread waiting for the notification thread, and
// avoid potential false positive reports.
m_node.validation_signals->SyncWithValidationInterfaceQueue();
// Shutdown sequence (c.f. Shutdown() in init.cpp)
coin_stats_index.Stop();
}

View File

@ -61,14 +61,6 @@ BOOST_FIXTURE_TEST_CASE(txindex_initial_sync, TestChain100Setup)
}
}
// It is not safe to stop and destroy the index until it finishes handling
// the last BlockConnected notification. The BlockUntilSyncedToCurrentChain()
// call above is sufficient to ensure this, but the
// SyncWithValidationInterfaceQueue() call below is also needed to ensure
// TSAN always sees the test thread waiting for the notification thread, and
// avoid potential false positive reports.
m_node.validation_signals->SyncWithValidationInterfaceQueue();
// shutdown sequence (c.f. Shutdown() in init.cpp)
txindex.Stop();
}

View File

@ -70,6 +70,7 @@ BOOST_FIXTURE_TEST_CASE(txospenderindex_initial_sync, TestChain100Setup)
BOOST_CHECK_EQUAL((*tx_spender)->block_hash, tip_hash);
}
// Shutdown sequence (c.f. Shutdown() in init.cpp)
txospenderindex.Stop();
}