diff options
-rw-r--r-- | src/test/util/index.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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 <test/util/index.h> #include <index/base.h> +#include <shutdown.h> +#include <util/check.h> #include <util/time.h> 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); } |