feat(lite): Console tab with connection + open/create diagnostics
The lite variant had no visibility into why a wallet failed to open — just a "disconnected" spinner. Add a lite-only Console tab (full-node keeps its RPC console) that shows a live diagnostic log. - LiteDiagnostics: a small thread-safe, bounded ring buffer (header-only). The controller writes to it from its background threads: each failover server attempt and result, wallet open/create/restore outcomes, sync start, and blocked-open reasons. The App logs controller (re)builds with the preferred server. - lite_console_tab: a terminal-styled, read-only view of the log (newest at the bottom, error/success lines coloured) with Clear / Copy / Auto-scroll. Reachable even when the wallet is locked (it's diagnostics, no secrets). Registered as NavPage::LiteConsole, gated lite-only via WalletUiSurface::LiteConsole. A unit test drives an open-with-failover and asserts the log records the connection attempt and the successful open. Built clean for full-node, lite, and Windows cross-compile. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
12
src/app.cpp
12
src/app.cpp
@@ -14,6 +14,7 @@
|
||||
#include "wallet/lite_wallet_controller.h"
|
||||
#include "wallet/lite_wallet_server_selection_adapter.h"
|
||||
#include "wallet/lite_rollout_policy.h"
|
||||
#include "wallet/lite_diagnostics.h"
|
||||
|
||||
#include <cstdlib> // std::getenv for the lite kill-switch env var
|
||||
#include <sodium.h> // sodium_memzero for the lite unlock-passphrase buffer
|
||||
@@ -29,6 +30,7 @@
|
||||
#include "ui/windows/mining_tab.h"
|
||||
#include "ui/windows/peers_tab.h"
|
||||
#include "ui/windows/network_tab.h"
|
||||
#include "ui/windows/lite_console_tab.h"
|
||||
#include "ui/windows/explorer_tab.h"
|
||||
#include "ui/windows/market_tab.h"
|
||||
#include "ui/windows/settings_window.h"
|
||||
@@ -443,10 +445,11 @@ void App::rebuildLiteWallet(bool force)
|
||||
// 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;
|
||||
|
||||
const auto liteConn = wallet::liteConnectionSettingsFromAppSettings(*settings_);
|
||||
wallet::liteLog(std::string(force ? "Lite controller rebuilt" : "Lite controller built") +
|
||||
" (preferred server: " + liteConn.stickyServerUrl + ")");
|
||||
lite_wallet_ = wallet::LiteWalletController::createLinked(
|
||||
walletCapabilities(),
|
||||
wallet::liteConnectionSettingsFromAppSettings(*settings_),
|
||||
resolveLiteRolloutDecision(*settings_));
|
||||
walletCapabilities(), liteConn, resolveLiteRolloutDecision(*settings_));
|
||||
lite_wallet_->setPersistCallback([this]() { settings_->save(); });
|
||||
|
||||
// The new controller starts closed. Re-arm the one-shot auto-open so the next update()
|
||||
@@ -1368,6 +1371,9 @@ void App::render()
|
||||
case ui::NavPage::LiteNetwork:
|
||||
ui::RenderLiteNetworkTab(this);
|
||||
break;
|
||||
case ui::NavPage::LiteConsole:
|
||||
ui::RenderLiteConsoleTab(this);
|
||||
break;
|
||||
case ui::NavPage::Explorer:
|
||||
ui::RenderExplorerTab(this);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user