Skip to content

Commit 861cb3f

Browse files
committed
test: move SyncWithValidationInterfaceQueue() before Stop() in txindex_tests
So that the call order is the same as in coinstatsindex_tests.
1 parent 6526dc3 commit 861cb3f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/test/txindex_tests.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,16 @@ BOOST_FIXTURE_TEST_CASE(txindex_initial_sync, TestChain100Setup)
6969
}
7070
}
7171

72+
// It is not safe to stop and destroy the index until it finishes handling
73+
// the last BlockConnected notification. The BlockUntilSyncedToCurrentChain()
74+
// call above is sufficient to ensure this, but the
75+
// SyncWithValidationInterfaceQueue() call below is also needed to ensure
76+
// TSAN always sees the test thread waiting for the notification thread, and
77+
// avoid potential false positive reports.
78+
SyncWithValidationInterfaceQueue();
79+
7280
// shutdown sequence (c.f. Shutdown() in init.cpp)
7381
txindex.Stop();
74-
75-
// Let scheduler events finish running to avoid accessing any memory related to txindex after it is destructed
76-
SyncWithValidationInterfaceQueue();
7782
}
7883

7984
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)