From: gg Date: Wed, 14 Jan 2026 18:18:07 +0000 (-0500) Subject: better reconnect logic/less network & log spam X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=7d5512b8aeff05103eb5c16580fda36cc9aba2bf;p=gamesguru%2Ffeather.git better reconnect logic/less network & log spam --- 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(); }