diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-06-23 14:45:02 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-06-23 14:40:55 +0200 |
commit | fa34cb80248cc39a73fc393f65c3cfc62e849556 (patch) | |
tree | abc9e7726a988e1bb86cfaba174d90599920742f /src/bitcoin-cli.cpp | |
parent | d6e0d78c31557660274ef53cac912c468eecbe2d (diff) |
cli: Avoid truncating -rpcwaittimeout
Diffstat (limited to 'src/bitcoin-cli.cpp')
-rw-r--r-- | src/bitcoin-cli.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index adc485983f..7a5f945511 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -797,7 +797,7 @@ static UniValue ConnectAndCallRPC(BaseRequestHandler* rh, const std::string& str // Execute and handle connection failures with -rpcwait. const bool fWait = gArgs.GetBoolArg("-rpcwait", false); const int timeout = gArgs.GetArg("-rpcwaittimeout", DEFAULT_WAIT_CLIENT_TIMEOUT); - const int64_t deadline = GetTime<std::chrono::seconds>().count() + timeout; + const auto deadline{GetTime<std::chrono::microseconds>() + 1s * timeout}; do { try { @@ -810,9 +810,9 @@ static UniValue ConnectAndCallRPC(BaseRequestHandler* rh, const std::string& str } break; // Connection succeeded, no need to retry. } catch (const CConnectionFailed& e) { - const int64_t now = GetTime<std::chrono::seconds>().count(); + const auto now{GetTime<std::chrono::microseconds>()}; if (fWait && (timeout <= 0 || now < deadline)) { - UninterruptibleSleep(std::chrono::seconds{1}); + UninterruptibleSleep(1s); } else { throw CConnectionFailed(strprintf("timeout on transient error: %s", e.what())); } |