diff --git a/src/test/util/index.cpp b/src/test/util/index.cpp index 89bc35b731..e653d5dbf0 100644 --- a/src/test/util/index.cpp +++ b/src/test/util/index.cpp @@ -5,11 +5,18 @@ #include #include +#include +#include #include void IndexWaitSynced(const BaseIndex& index) { while (!index.BlockUntilSyncedToCurrentChain()) { + // Assert shutdown was not requested to abort the test, instead of looping forever, in case + // there was an unexpected error in the index that caused it to stop syncing and request a shutdown. + Assert(!ShutdownRequested()); + UninterruptibleSleep(100ms); } + assert(index.GetSummary().synced); }