Skip to content

Commit

Permalink
fix: avoid re-initializing g_txindex by checking first
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Jul 16, 2024
1 parent f16025f commit 9316b61
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/test/util/setup_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,10 @@ void TestChainSetup::mineBlocks(int num_blocks)
m_coinbase_txns.push_back(b.vtx[0]);
}

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

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

0 comments on commit 9316b61

Please sign in to comment.