0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00

rpc: Prefix rpcwaittimeout error with details on its nature

As proposed by @laanwj the error message is now prefixed with the
"timeout on transient error:" prefix, to explain why the error is
suddenly considered terminal.
This commit is contained in:
Christian Decker 2021-03-23 14:39:25 +01:00
parent c490e17ef6
commit f76cb10d7d

View file

@ -809,12 +809,12 @@ static UniValue ConnectAndCallRPC(BaseRequestHandler* rh, const std::string& str
}
}
break; // Connection succeeded, no need to retry.
} catch (const CConnectionFailed&) {
} catch (const CConnectionFailed& e) {
const int64_t now = GetTime<std::chrono::seconds>().count();
if (fWait && (timeout <= 0 || now < deadline)) {
UninterruptibleSleep(std::chrono::seconds{1});
} else {
throw;
throw CConnectionFailed(strprintf("timeout on transient error: %s", e.what()));
}
}
} while (fWait);