feat: non-blocking warmup — connect during daemon initialization

Instead of blocking the entire UI with "Activating best chain..." until
the daemon finishes warmup, treat warmup responses as a successful
connection. The wallet now:

- Sets connected=true + warming_up=true when daemon returns RPC -28
- Shows warmup status with block progress in the loading overlay
- Polls getinfo every few seconds to detect warmup completion
- Allows Console, Peers, Settings tabs during warmup
- Shows orange status indicator with warmup message in status bar
- Skips balance/tx/address refresh until warmup completes
- Triggers full data refresh once daemon is ready

Also: fix curl handle/header leak on reconnect, fill in empty
externalDetected error branch, bump version to v1.2.0 in build scripts.
This commit is contained in:
2026-04-12 14:32:57 -05:00
parent 1860e9b277
commit d2dccbac05
9 changed files with 181 additions and 29 deletions

View File

@@ -610,13 +610,16 @@ void App::update()
core_timer_ = 0.0f;
refreshCoreData();
}
if (transaction_timer_ >= active_tx_interval_) {
transaction_timer_ = 0.0f;
refreshTransactionData();
}
if (address_timer_ >= active_addr_interval_) {
address_timer_ = 0.0f;
refreshAddressData();
// Skip balance/tx/address refresh during warmup — RPC calls fail with -28
if (!state_.warming_up) {
if (transaction_timer_ >= active_tx_interval_) {
transaction_timer_ = 0.0f;
refreshTransactionData();
}
if (address_timer_ >= active_addr_interval_) {
address_timer_ = 0.0f;
refreshAddressData();
}
}
if (peer_timer_ >= active_peer_interval_) {
peer_timer_ = 0.0f;
@@ -1087,7 +1090,7 @@ void App::render()
bool pageNeedsDaemon = (current_page_ != ui::NavPage::Console &&
current_page_ != ui::NavPage::Peers &&
current_page_ != ui::NavPage::Settings);
bool daemonReady = state_.connected; // don't gate on sync state
bool daemonReady = state_.connected && !state_.warming_up;
// Don't show lock screen while pool mining — xmrig runs independently
// of the wallet and locking would block the mining UI needlessly.
@@ -1095,6 +1098,11 @@ void App::render()
if (state_.isLocked() && !poolMiningActive) {
// Lock screen — covers tab content just like the loading overlay
renderLockScreen();
} else if (state_.warming_up) {
// Daemon is reachable but still initializing — show warmup overlay
// without blocking on encryption state (getwalletinfo fails during warmup)
lock_screen_was_visible_ = false;
renderLoadingOverlay(contentH);
} else if (pageNeedsDaemon && (!daemonReady || (state_.connected && !state_.encryption_state_known))) {
// Track how long we've been waiting for encryption state
if (state_.connected && !state_.encryption_state_known) {
@@ -1421,7 +1429,16 @@ void App::renderStatusBar()
// Connection status
float dotOpacity = S.drawElement("components.status-bar", "connection-dot").opacity;
if (dotOpacity < 0.0f) dotOpacity = 1.0f;
if (state_.connected) {
if (state_.warming_up) {
ImGui::PushFont(ui::material::Type().iconSmall());
ImGui::TextColored(ImVec4(1.0f, 0.7f, 0.0f, dotOpacity), ICON_MD_CIRCLE);
ImGui::PopFont();
ImGui::SameLine(0, sbIconTextGap);
// Show truncated warmup status (e.g. "Activating best chain... (Block 12345)")
const char* warmupText = state_.warmup_status.empty()
? "Warming up..." : state_.warmup_status.c_str();
ImGui::TextColored(ImVec4(1.0f, 0.8f, 0.0f, 1.0f), "%s", warmupText);
} else if (state_.connected) {
ImGui::PushFont(ui::material::Type().iconSmall());
ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, dotOpacity), ICON_MD_CIRCLE);
ImGui::PopFont();