diff options
author | furszy <matiasfurszyfer@protonmail.com> | 2023-07-07 10:14:03 -0300 |
---|---|---|
committer | furszy <matiasfurszyfer@protonmail.com> | 2023-07-10 15:27:13 -0300 |
commit | 89ba8905f5c68ae29412f9c4010314c5a113c234 (patch) | |
tree | 363729ece0b320aab2efcf031f51791507382140 /src | |
parent | cf4da5ec29f9e8cd6cc6577e5ecbd87174edba62 (diff) |
test: indexes, fix on error infinite loop
As index sync failures trigger a shutdown request without notifying
BaseIndex::BlockUntilSyncedToCurrentChain in any way, we also need
to check whether a shutdown was requested or not inside 'IndexWaitSynced'.
Otherwise, any error inside the index sync process will hang the test
forever.
Diffstat (limited to 'src')
-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); } |