From 788d71a54980916e6097b41e22dae15e84634f27 Mon Sep 17 00:00:00 2001 From: DanS Date: Sun, 7 Jun 2026 22:26:06 -0500 Subject: [PATCH] fix(lite): report the preferred server's error on a failed open MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The failover overwrote outcome.error on every attempt, so a total open failure reported whichever (often broken) fallback was tried last — e.g. lite5's "CertNotValidForName" — instead of what the user's preferred server actually did. Keep the first (preferred) server's error as the summary so "Open failed: …" names the actionable reason; the per-server attempts are still in the Console log, and the warmup flag is still set if any server was warming up. Co-Authored-By: Claude Opus 4.8 --- src/wallet/lite_wallet_controller.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wallet/lite_wallet_controller.cpp b/src/wallet/lite_wallet_controller.cpp index 5502168..f154ffe 100644 --- a/src/wallet/lite_wallet_controller.cpp +++ b/src/wallet/lite_wallet_controller.cpp @@ -356,7 +356,7 @@ bool LiteWalletController::beginOpenExisting() auto resultSlot = openResult_; openThread_ = std::thread([bridge, servers, running, resultMutex, resultSlot]() { OpenOutcome outcome; - outcome.error = "could not reach any lite server"; + std::string preferredError; // error from the FIRST (preferred) server — the actionable one for (const auto& url : servers) { if (!bridge) break; liteLog(" connecting to " + url + " ..."); @@ -372,10 +372,14 @@ bool LiteWalletController::beginOpenExisting() const std::string why = call.error.empty() ? "unreachable" : call.error; liteLog(" " + url + ": " + why); if (!call.error.empty()) { - outcome.error = call.error; + if (preferredError.empty()) preferredError = call.error; // keep the preferred one if (liteOpenErrorIsWarmup(call.error)) outcome.warming = true; // healthy, just starting } } + // On total failure, report the preferred server's error (not whichever broken fallback + // happened to be tried last), since that's the server the user expects to use. + if (!outcome.ok) + outcome.error = preferredError.empty() ? "could not reach any lite server" : preferredError; { std::lock_guard lk(*resultMutex); *resultSlot = outcome;