fix(lite): drop the 15 s startup overlay and a TLS connection per refresh

- The refresh-model mapper marks the encryption state known when the
  backend reports it. The wallet tabs wait for that, so every Lite
  launch sat behind the loading overlay until the 15 s "assume
  unencrypted" fallback.
- Each 2 s refresh skips the backend's `info` (a fresh TLS connection
  and GetLightdInfo, only a fallback for the chat tip, which the
  explicit height call already provides) and the gateway's `height`
  (replaced by that explicit call, which runs after the sync commands
  so it sees the newest block).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 19:52:10 -05:00
co-authored by Claude Opus 5.5
parent 2cf183ddd9
commit 7fa7c3d6da
2 changed files with 18 additions and 1 deletions
+9 -1
View File
@@ -239,9 +239,12 @@ void applyLiteRefreshModelToWalletState(const LiteWalletAppRefreshModel& model,
} }
if (model.hasEncryptionStatus) { if (model.hasEncryptionStatus) {
// Reflect backend encryption state so isLocked()/isEncrypted() gate the UI correctly. // Reflect backend encryption state so isLocked()/isEncrypted() gate the UI correctly, and mark
// it known: the wallet tabs wait for that, and without it lite always sat behind the loading
// overlay until its 15 s "assume unencrypted" fallback.
state.encrypted = model.encrypted; state.encrypted = model.encrypted;
state.locked = model.locked; state.locked = model.locked;
state.encryption_state_known = true;
} }
} }
@@ -744,6 +747,11 @@ std::optional<LiteWalletAppRefreshModel> LiteWalletController::refreshModel()
// Synced: full refresh (balance/addresses/transactions are fast now). // Synced: full refresh (balance/addresses/transactions are fast now).
LiteWalletRefreshRequest request; LiteWalletRefreshRequest request;
// Skip `info` (a fresh TLS connection + GetLightdInfo every cycle, and only a fallback for the chat
// tip, which the height below already provides) and the gateway's `height` (the explicit call after
// the refresh replaces it, and runs after the syncing commands so it sees the newest block).
request.includeInfo = false;
request.includeHeight = false;
if (syncResult.ok) { if (syncResult.ok) {
request.haveSyncStatus = true; request.haveSyncStatus = true;
request.syncStatus = syncResult.syncStatus; request.syncStatus = syncResult.syncStatus;
+9
View File
@@ -6840,6 +6840,15 @@ void testLiteWalletControllerEncryption()
applyLiteRefreshModelToWalletState(model, state); applyLiteRefreshModelToWalletState(model, state);
EXPECT_TRUE(state.isEncrypted()); EXPECT_TRUE(state.isEncrypted());
EXPECT_TRUE(state.isLocked()); EXPECT_TRUE(state.isLocked());
// ...and marks it known: the wallet tabs wait for that (lite used to sit behind the loading
// overlay until the 15 s "assume unencrypted" fallback).
EXPECT_TRUE(state.encryption_state_known);
LiteWalletAppRefreshModel syncOnly;
syncOnly.hasSyncStatus = true;
dragonx::WalletState untouched;
applyLiteRefreshModelToWalletState(syncOnly, untouched);
EXPECT_FALSE(untouched.encryption_state_known);
} }
} }