mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
test: Avoid unsafe memory race in baseindex_no_commit_ahead_of_flush
Without the drain, a BlockConnected event may execute during shutdown and lead to memory races.
This commit is contained in:
@@ -84,6 +84,10 @@ BOOST_FIXTURE_TEST_CASE(baseindex_no_commit_ahead_of_flush, TestChain100Setup)
|
||||
// Reload index to see which block data was actually committed.
|
||||
BOOST_REQUIRE(index->Init());
|
||||
BOOST_CHECK_EQUAL(index->GetSummary().best_block_height, expected_commit_height);
|
||||
|
||||
// Drain in-flight validation callbacks before destroying the index.
|
||||
m_node.chain->context()->validation_signals->SyncWithValidationInterfaceQueue();
|
||||
// shutdown sequence (c.f. Shutdown() in init.cpp)
|
||||
index->Stop();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user