feat(lite): ObsidianDragonLite Network tab — server browser
A lite-wallet-only "Network" tab (full-node keeps the Peers tab; exactly one shows per variant) to manage lightwalletd servers, replacing the basic selector that was in Settings. - Card list of servers with per-server latency + status dot, DNS host + resolved IP, and an Official/Custom pill. Official DragonX servers get a glowing outline. - Pick a server (Sticky) by clicking its card, or toggle "use a random server" (Random mode); selection applies immediately (App::rebuildLiteWallet(force=true) tears down + rebuilds the controller against the new server and resyncs — its dtor detaches the uninterruptible sync thread, so this doesn't block). - Add custom servers; hide/unhide servers (persisted set, revealed by a "Show hidden" toggle). - Latency/IP come from a new background probe (util/LiteServerProbe): libcurl CONNECT_ONLY does the TCP+TLS handshake (works for gRPC lightwalletd, no HTTP response needed), recording APPCONNECT_TIME as latency and CURLINFO_PRIMARY_IP. Auto-runs on tab open + a Refresh button. Wiring: WalletUiSurface::LiteNetwork (gated !fullNodePagesAvailable) + NavPage::LiteNetwork in the sidebar + app.cpp dispatch; settings gains a hidden-servers set; isOfficialLiteServer() added to lite_connection_service. The Settings page lite-server selector + its plumbing are removed (single source of truth = the tab). Reuses the existing server model (LiteServerPreference, Sticky/Random, selectLiteServer) and UI primitives (DrawGlassPanel, ThemeEffects glow, peers-tab ping-dot idiom). Unit-tested (liteServerHost, isOfficialLiteServer) + an env-gated live probe (verified vs lite.dragonx.is: online, latency, IP). Both variants + lite-backend build; suite passes; hygiene clean; GUI smoke-launched without crash. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
20
src/app.cpp
20
src/app.cpp
@@ -28,6 +28,7 @@
|
||||
#include "ui/windows/transactions_tab.h"
|
||||
#include "ui/windows/mining_tab.h"
|
||||
#include "ui/windows/peers_tab.h"
|
||||
#include "ui/windows/network_tab.h"
|
||||
#include "ui/windows/explorer_tab.h"
|
||||
#include "ui/windows/market_tab.h"
|
||||
#include "ui/windows/settings_window.h"
|
||||
@@ -429,14 +430,18 @@ wallet::LiteRolloutDecision resolveLiteRolloutDecision(config::Settings& setting
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void App::rebuildLiteWallet()
|
||||
void App::rebuildLiteWallet(bool force)
|
||||
{
|
||||
if (!supportsLiteBackend() || !settings_) return;
|
||||
// Don't tear down a live session: if a wallet is already open (and possibly mid-sync), the
|
||||
// new server selection is already persisted to settings and will take effect the next time
|
||||
// the controller is built (next launch, or before another wallet is opened). Rebuilding now
|
||||
// would discard the open wallet and its in-flight, uninterruptible sync.
|
||||
if (lite_wallet_ && lite_wallet_->walletOpen()) return;
|
||||
// Don't tear down a live session unless forced: if a wallet is already open (and possibly
|
||||
// mid-sync), the new server selection is already persisted to settings and will take effect
|
||||
// the next time the controller is built (next launch, or before another wallet is opened).
|
||||
// Rebuilding would discard the open wallet and its in-flight, uninterruptible sync — which is
|
||||
// exactly what the Network tab's apply-immediately server switch wants (force=true). Replacing
|
||||
// lite_wallet_ destroys the old controller; its destructor detaches the uninterruptible sync
|
||||
// thread (which keeps the shared bridge alive) and only joins the short poll worker, so this
|
||||
// does not block. The app's auto-open loop then reopens the wallet against the new server.
|
||||
if (!force && lite_wallet_ && lite_wallet_->walletOpen()) return;
|
||||
|
||||
lite_wallet_ = wallet::LiteWalletController::createLinked(
|
||||
walletCapabilities(),
|
||||
@@ -1318,6 +1323,9 @@ void App::render()
|
||||
case ui::NavPage::Peers:
|
||||
ui::RenderPeersTab(this);
|
||||
break;
|
||||
case ui::NavPage::LiteNetwork:
|
||||
ui::RenderLiteNetworkTab(this);
|
||||
break;
|
||||
case ui::NavPage::Explorer:
|
||||
ui::RenderExplorerTab(this);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user