From 28b9e0dffb545cc4489e0057ba6a641610a7538a Mon Sep 17 00:00:00 2001 From: dan_s Date: Sun, 12 Apr 2026 13:43:45 -0500 Subject: [PATCH] fix: auto-refresh peers list, show warmup status during daemon startup - Fix peer timer calling refreshEncryptionState() instead of refreshPeerInfo(), so the Network tab now auto-updates every 5s - Reorder RPC error handling so warmup messages (Loading block index, Verifying blocks, etc.) display in the status bar instead of being masked by the generic "Waiting for dragonxd" message --- src/app.cpp | 2 +- src/app_network.cpp | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/app.cpp b/src/app.cpp index a8b695b..4b1ce09 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -620,7 +620,7 @@ void App::update() } if (peer_timer_ >= active_peer_interval_) { peer_timer_ = 0.0f; - refreshEncryptionState(); + refreshPeerInfo(); } } else if (core_timer_ >= active_core_interval_) { core_timer_ = 0.0f; diff --git a/src/app_network.cpp b/src/app_network.cpp index 5f54e39..a52c6b1 100644 --- a/src/app_network.cpp +++ b/src/app_network.cpp @@ -203,18 +203,6 @@ void App::tryConnect() "RPC authentication failed (HTTP 401). " "The rpcuser/rpcpassword in DRAGONX.conf don't match the running daemon. " "Restart the daemon or correct the credentials."); - } else if (daemonStarting) { - state_.connected = false; - connection_status_ = "Waiting for dragonxd to start..."; - VERBOSE_LOGF("[connect #%d] RPC connection failed — daemon still starting, will retry...\n", attempt); - // Fast retry: force the refresh timer to fire on the next cycle - // instead of waiting the full 5-second interval. - core_timer_ = CORE_INTERVAL_DEFAULT - 1.0f; - } else if (externalDetected) { - state_.connected = false; - connection_status_ = "Connecting to daemon..."; - VERBOSE_LOGF("[connect #%d] RPC connection failed — external daemon on port but RPC not ready yet, will retry...\n", attempt); - core_timer_ = CORE_INTERVAL_DEFAULT - 1.0f; } else if (connectErr.find("Loading") != std::string::npos || connectErr.find("Verifying") != std::string::npos || connectErr.find("Activating") != std::string::npos || @@ -222,10 +210,24 @@ void App::tryConnect() connectErr.find("Rescanning") != std::string::npos || connectErr.find("Pruning") != std::string::npos) { // Daemon is reachable but still in warmup (Loading block index, etc.) + // Check this BEFORE daemonStarting so the actual warmup status is shown. state_.connected = false; connection_status_ = connectErr; VERBOSE_LOGF("[connect #%d] Daemon warmup: %s\n", attempt, connectErr.c_str()); core_timer_ = CORE_INTERVAL_DEFAULT - 1.0f; + } else if (daemonStarting) { + state_.connected = false; + // Show the actual RPC error alongside the waiting message so + // auth mismatches and timeouts aren't silently hidden. + if (!connectErr.empty()) { + connection_status_ = "Waiting for dragonxd — " + connectErr; + } else { + connection_status_ = "Waiting for dragonxd to start..."; + } + VERBOSE_LOGF("[connect #%d] RPC connection failed (%s) — daemon still starting, will retry...\n", + attempt, connectErr.c_str()); + core_timer_ = CORE_INTERVAL_DEFAULT - 1.0f; + } else if (externalDetected) { } else { onDisconnected("Connection failed"); VERBOSE_LOGF("[connect #%d] RPC connection failed — no daemon starting, no external detected\n", attempt);