fix(lite): surface auto-open failures instead of a silent disconnected spinner

The startup auto-open of an existing lite wallet discarded openWallet()'s result,
so when initialize_existing failed (e.g. the lightwalletd server is unreachable)
the UI just showed a "disconnected" spinner with no reason — and DEBUG_LOGF is
compiled out of release builds, so there was no way to see why. Capture the
failure: store the reason, show it in the Network tab status line (in place of
"no wallet open"), and raise a notification. Cleared once a wallet opens.

This doesn't change open behaviour — it makes a stuck open diagnosable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 15:39:22 -05:00
parent 142a6826af
commit 6531d0c4d2
3 changed files with 26 additions and 5 deletions

View File

@@ -122,10 +122,14 @@ void RenderLiteNetworkTab(App* app)
OnSurfaceMedium(), inUse.c_str());
// Bottom row: sync detail + (while syncing) a thin progress bar.
char syncBuf[96];
if (!connected)
snprintf(syncBuf, sizeof(syncBuf), "%s: %s", TR("lite_net_sync_label"), TR("lite_net_no_wallet"));
else if (sync.syncing)
char syncBuf[160];
if (!connected) {
// If an auto-open actually failed, show why (e.g. server unreachable) instead of a
// bare "no wallet open" — otherwise the disconnected state is silent/confusing.
const std::string& openErr = app->liteOpenError();
snprintf(syncBuf, sizeof(syncBuf), "%s: %s", TR("lite_net_sync_label"),
openErr.empty() ? TR("lite_net_no_wallet") : openErr.c_str());
} else if (sync.syncing)
snprintf(syncBuf, sizeof(syncBuf), "%s: %.1f%% · %d / %d", TR("lite_net_sync_label"),
sync.verification_progress * 100.0, sync.blocks, sync.headers);
else