Skip to content

Commit 77915de

Browse files
committed
test: run Interrupt() before Stop(), add additional sanity check
1 parent a376e93 commit 77915de

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/test/util/setup_common.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ TestChainSetup::TestChainSetup(int num_blocks, const std::vector<const char*>& e
325325

326326
// Initialize transaction index *after* chain has been constructed
327327
g_txindex = std::make_unique<TxIndex>(1 << 20, true);
328+
assert(!g_txindex->BlockUntilSyncedToCurrentChain());
328329
if (!g_txindex->Start(m_node.chainman->ActiveChainstate())) {
329330
throw std::runtime_error("TxIndex::Start() failed.");
330331
}
@@ -506,6 +507,7 @@ TestChainSetup::~TestChainSetup()
506507
// we might be destroying it while scheduler still has some work for it
507508
// e.g. via BlockConnected signal
508509
IndexWaitSynced(*g_txindex);
510+
g_txindex->Interrupt();
509511
g_txindex->Stop();
510512
SyncWithValidationInterfaceQueue();
511513
g_txindex.reset();

0 commit comments

Comments
 (0)