Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow tx index to catch up with the block index in TestChainSetup dtor #5454

Merged
merged 2 commits into from
Jun 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/test/util/setup_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,15 @@ CBlock TestChainSetup::CreateBlock(const std::vector<CMutableTransaction>& txns,

TestChainSetup::~TestChainSetup()
{
// Allow tx index to catch up with the block index cause otherwise
// we might be destroying it while scheduler still has some work for it
// e.g. via BlockConnected signal
int64_t time_start = GetTimeMillis();
while (!g_txindex->BlockUntilSyncedToCurrentChain()) {
static constexpr int64_t timeout_ms = 10 * 1000;
assert(time_start + timeout_ms > GetTimeMillis());
UninterruptibleSleep(std::chrono::milliseconds{100});
}
g_txindex->Interrupt();
g_txindex->Stop();
g_txindex.reset();
Expand Down
Loading