From 7d5512b8aeff05103eb5c16580fda36cc9aba2bf Mon Sep 17 00:00:00 2001 From: gg Date: Wed, 14 Jan 2026 13:18:07 -0500 Subject: [PATCH] better reconnect logic/less network & log spam --- src/MainWindow.cpp | 7 ++++--- src/utils/nodes.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index fe200e3b..e4d6d943 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -227,7 +227,6 @@ void MainWindow::initStatusBar() { m_actionEnableWebsocket = new QAction(tr("Enable Websocket"), this); m_actionEnableWebsocket->setCheckable(true); m_actionEnableWebsocket->setChecked(!conf()->get(Config::disableWebsocket).toBool()); - m_statusLabelStatus->addAction(m_actionEnableWebsocket); connect(m_actionEnableWebsocket, &QAction::toggled, this, [](bool checked){ conf()->set(Config::disableWebsocket, !checked); @@ -252,7 +251,7 @@ void MainWindow::initStatusBar() { QAction *scanTxAction = new QAction(tr("Import Transaction"), this); m_statusLabelStatus->addAction(scanTxAction); - m_updateNetworkInfoAction = new QAction(tr("Update Network Info"), this); + m_updateNetworkInfoAction = new QAction(tr("Scan Now"), this); m_updateNetworkInfoAction->setEnabled(!pauseSyncAction->isChecked()); m_statusLabelStatus->addAction(m_updateNetworkInfoAction); @@ -614,7 +613,9 @@ void MainWindow::initOffline() { connect(m_updateNetworkInfoAction, &QAction::triggered, this, [this]() { if (!m_wallet) return; - this->setStatusText(tr("Scanning (Fetching network info)...")); + qDebug() << "Scanning wallet..."; + this->setStatusText(tr("Scanning...")); + QApplication::processEvents(); // Ensure status text is visible immediately m_wallet->updateNetworkStatus(); }); diff --git a/src/utils/nodes.cpp b/src/utils/nodes.cpp index 6611d76d..323fa346 100644 --- a/src/utils/nodes.cpp +++ b/src/utils/nodes.cpp @@ -298,6 +298,15 @@ void Nodes::autoConnect(bool forceReconnect) { } if (status == Wallet::ConnectionStatus_Disconnected || forceReconnect) { + // If we had a working connection and it dropped (transient disconnect), + // try reconnecting to the same node instead of picking a new one + if (m_connection.isValid() && m_connection.isActive && !forceReconnect) { + qDebug() << "Transient disconnect, reconnecting to same node:" << m_connection.toAddress(); + this->connectToNode(m_connection); + return; + } + + // Otherwise, mark the failed node and pick a new one if (m_connection.isValid() && !forceReconnect) { m_recentFailures << m_connection.toAddress(); } -- 2.52.0