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
This commit is contained in:
dan_s
2026-04-12 13:43:45 -05:00
parent 6be0a58c26
commit 28b9e0dffb
2 changed files with 15 additions and 13 deletions

View File

@@ -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;

View File

@@ -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);