fix(lite): fast retry when a server is only warming up (-28)
When the preferred lightwalletd server is reachable but warming up (JSON-RPC -28 / "Activating best chain"), the failover treated it like a dead server and fell through to the others, so the wallet didn't open until the next 20s retry — even though the healthy server was ready within seconds. Detect the warmup error during failover, flag it on the open outcome (lastOpenWasWarmup()), and have the App retry on a short ~4s interval in that case instead of 20s, so the wallet opens promptly once warmup clears. A unit test covers a warming-preferred + dead-fallback open setting the flag. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -490,11 +490,13 @@ void App::update()
|
||||
// needs no passphrase — it just loads the file and contacts the server). Running it off
|
||||
// the UI thread means an unreachable server never freezes startup, and trying the other
|
||||
// default servers means one dead server no longer strands the wallet. Retried on an
|
||||
// interval so a transient outage self-heals once a server comes back.
|
||||
// interval so a transient outage self-heals once a server comes back — and much sooner
|
||||
// (a few seconds) when the failure was a server merely warming up (-28), which clears fast.
|
||||
const double nowSecs = ImGui::GetTime();
|
||||
const double retryInterval = lite_wallet_->lastOpenWasWarmup() ? 4.0 : 20.0;
|
||||
if (!lite_wallet_->walletOpen() && !lite_wallet_->openInProgress() &&
|
||||
lite_wallet_->walletExists() &&
|
||||
(!lite_autoopen_done_ || nowSecs - lite_open_last_attempt_ > 20.0)) {
|
||||
(!lite_autoopen_done_ || nowSecs - lite_open_last_attempt_ > retryInterval)) {
|
||||
lite_autoopen_done_ = true;
|
||||
lite_open_last_attempt_ = nowSecs;
|
||||
lite_wallet_->beginOpenExisting();
|
||||
|
||||
Reference in New Issue
Block a user