Skip to content

Commit

Permalink
test: run Interrupt() before Stop(), add additional sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Jul 18, 2024
1 parent a376e93 commit 77915de
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/test/util/setup_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ TestChainSetup::TestChainSetup(int num_blocks, const std::vector<const char*>& e

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

0 comments on commit 77915de

Please sign in to comment.