fix(lite): re-open the wallet after a controller rebuild (server-switch recovery)

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 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 16:34:37 -05:00
parent 79e5adcbd3
commit 9ff5508989

View File

@@ -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()