Skip to content

Commit 9316b61

Browse files
committed
fix: avoid re-initializing g_txindex by checking first
1 parent f16025f commit 9316b61

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/test/util/setup_common.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,10 @@ void TestChainSetup::mineBlocks(int num_blocks)
361361
m_coinbase_txns.push_back(b.vtx[0]);
362362
}
363363

364-
g_txindex = std::make_unique<TxIndex>(1 << 20, true);
365-
assert(g_txindex->Start(m_node.chainman->ActiveChainstate()));
364+
if (!g_txindex) {
365+
g_txindex = std::make_unique<TxIndex>(1 << 20, true);
366+
assert(g_txindex->Start(m_node.chainman->ActiveChainstate()));
367+
}
366368

367369
// Allow tx index to catch up with the block index.
368370
IndexWaitSynced(*g_txindex);

0 commit comments

Comments
 (0)