fix(lite): always-populated Console (live status) + single-instance log
The Console could look empty if the wallet produced few events. Make it useful in every state and remove a cross-platform footgun: - Add a live status header read straight from the controller (connected / connecting / disconnected, sync %, and the last open error) — independent of the diagnostics event log, so the Console always shows the current connection + wallet-open state even when the log is sparse. - Move LiteDiagnostics::instance() into a single .cpp so there is exactly one instance across the binary, rather than relying on the linker folding an inline-function static across translation units (a known fragility, especially on mingw/Windows — the most likely cause of a stuck-empty event log there). Verified the writer and reader share one instance on Linux; builds clean for full-node, lite, and Windows cross-compile; tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
19
src/wallet/lite_diagnostics.cpp
Normal file
19
src/wallet/lite_diagnostics.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
// DragonX Wallet - ImGui Edition
|
||||
// Copyright 2024-2026 The Hush Developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#include "lite_diagnostics.h"
|
||||
|
||||
namespace dragonx {
|
||||
namespace wallet {
|
||||
|
||||
// Single definition in one translation unit guarantees exactly one shared instance across the
|
||||
// binary (writers in the controller/App, reader in the lite Console tab all see the same log).
|
||||
LiteDiagnostics& LiteDiagnostics::instance()
|
||||
{
|
||||
static LiteDiagnostics inst;
|
||||
return inst;
|
||||
}
|
||||
|
||||
} // namespace wallet
|
||||
} // namespace dragonx
|
||||
@@ -24,10 +24,9 @@ namespace wallet {
|
||||
|
||||
class LiteDiagnostics {
|
||||
public:
|
||||
static LiteDiagnostics& instance() {
|
||||
static LiteDiagnostics inst;
|
||||
return inst;
|
||||
}
|
||||
// Defined in lite_diagnostics.cpp (a single TU) so there is exactly one instance across the
|
||||
// whole binary — no reliance on the linker folding an inline-function static across TUs.
|
||||
static LiteDiagnostics& instance();
|
||||
|
||||
// Append a timestamped line (thread-safe). Safe to call from background threads.
|
||||
void log(const std::string& message) {
|
||||
|
||||
Reference in New Issue
Block a user