From 9ff55089894634b952177db07c670a0e540467d7 Mon Sep 17 00:00:00 2001 From: DanS Date: Sun, 7 Jun 2026 16:34:37 -0500 Subject: [PATCH] fix(lite): re-open the wallet after a controller rebuild (server-switch recovery) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wallet auto-open is a one-shot (lite_autoopen_done_), but rebuildLiteWallet() creates a fresh, closed controller — so switching the lite server from the Network tab (rebuildLiteWallet force=true), or any later rebuild, left the wallet permanently closed ("disconnected" spinner) because auto-open never fired again. Re-arm the one-shot (and clear the surfaced open-error) in rebuildLiteWallet so the next update() tick reopens the existing wallet against the new server. This is the recovery path when the configured lightwalletd server is unreachable: the Network tab surfaces the failure reason, the user picks a reachable server, and the wallet reopens. Also makes the Network tab's apply-immediately server switch actually take effect. Co-Authored-By: Claude Opus 4.8 --- src/app.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app.cpp b/src/app.cpp index d767a8f..61ddf34 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -448,6 +448,13 @@ void App::rebuildLiteWallet(bool force) wallet::liteConnectionSettingsFromAppSettings(*settings_), resolveLiteRolloutDecision(*settings_)); lite_wallet_->setPersistCallback([this]() { settings_->save(); }); + + // The new controller starts closed. Re-arm the one-shot auto-open so the next update() + // tick reopens the existing wallet against the (possibly changed) server — otherwise a + // server switch from the Network tab, or a retry after a failed open, would rebuild the + // controller but never reopen, leaving a permanent "disconnected" state. + lite_autoopen_done_ = false; + lite_open_error_.clear(); } void App::update()