aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2023-07-11 12:11:01 -0400
committerRyan Ofsky <ryan@ofsky.org>2023-07-11 12:30:56 -0400
commit99b3af78bd5209b3ed0b192d0b18ee2c49079d1d (patch)
treed88490bc5727f98a5259d8369c2d58f414f4f67f
parente253568da8dc3693ad99aee260276233245e3d77 (diff)
parent89ba8905f5c68ae29412f9c4010314c5a113c234 (diff)
Merge bitcoin/bitcoin#28044: test: indexes, fix on error infinite loop
89ba8905f5c68ae29412f9c4010314c5a113c234 test: indexes, fix on error infinite loop (furszy) Pull request description: Coming from https://github.com/bitcoin/bitcoin/pull/28036#issuecomment-1623813703, I thought that we were going to fix it there but seems that got merged without it for some reason. 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. ACKs for top commit: MarcoFalke: lgtm ACK 89ba8905f5c68ae29412f9c4010314c5a113c234 jamesob: ACK 89ba890 ryanofsky: Code review ACK 89ba8905f5c68ae29412f9c4010314c5a113c234. Just comment update since last review Tree-SHA512: 1f6daf34e51d3fbc802799bfa4ac0ef0d8f774db5f9e2f5d35df18a77679778475c94efc3da1fb723ebaf3583e4075e4a5cbe4a5104ad0c50e2b32076e247b29
-rw-r--r--src/test/util/index.cpp7
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);
}