From: gg Date: Mon, 19 Jan 2026 21:17:36 +0000 (-0500) Subject: wip X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=fb12de7f4a7d17582af3ad330ddb9562f7d2c319;p=gamesguru%2Ffeather.git wip --- diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 3142dce9..e645422b 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -259,7 +259,7 @@ void MainWindow::initStatusBar() { QAction *scanTxAction = new QAction(tr("Import Transaction"), this); m_statusLabelStatus->addAction(scanTxAction); - m_updateNetworkInfoAction = new QAction(tr("Scan Mempool"), this); + m_updateNetworkInfoAction = new QAction(tr("Scan mempool when paused"), this); m_statusLabelStatus->addAction(m_updateNetworkInfoAction); connect(m_actionPauseSync, &QAction::toggled, this, [this](bool checked) { @@ -604,18 +604,18 @@ void MainWindow::initOffline() { ui->radio_airgapUR->setChecked(true); } - connect(m_updateNetworkInfoAction, &QAction::triggered, this, [this]() { + m_updateNetworkInfoAction->setCheckable(true); + connect(m_updateNetworkInfoAction, &QAction::toggled, this, [this](bool checked) { if (!m_wallet) return; + + m_wallet->setScanMempoolWhenPaused(checked); - qDebug() << "[UI] User requested network info and scan of mempool"; - - // FIX: Temporarily connect if we are disconnected/paused - if (m_wallet->connectionStatus() == Wallet::ConnectionStatus_Disconnected) { - m_nodes->connectToNode(); + if (checked) { + // Ensure we are connected if enabling + if (m_wallet->connectionStatus() == Wallet::ConnectionStatus_Disconnected) { + m_nodes->connectToNode(); + } } - - // Trigger the refresh (sets m_refreshNow = true, bypassing the pause check) - m_wallet->startRefresh(true); }); @@ -1087,10 +1087,16 @@ void MainWindow::onConnectionStatusChanged(int status) switch(status){ case Wallet::ConnectionStatus_Idle: { - if (conf()->get(Config::proxy).toInt() == Config::Proxy::Tor) { - icon = icons()->icon("status_idle_proxy.svg"); + // If "Scan Mempool" is active, we show "Idle" (connected/active) + if (m_updateNetworkInfoAction->isChecked()) { + if (conf()->get(Config::proxy).toInt() == Config::Proxy::Tor) { + icon = icons()->icon("status_idle_proxy.svg"); + } else { + icon = icons()->icon("status_idle.svg"); + } } else { - icon = icons()->icon("status_idle.svg"); + // "True Idle" - just waiting, no network activity + icon = icons()->icon("status_waiting.svg"); } statusStr = this->getPausedStatusText(); m_statusLabelNetStats->hide(); diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index b479fd74..d2ec3d5a 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -533,7 +533,7 @@ void Wallet::startRefreshThread() if (elapsed >= std::chrono::seconds(m_refreshInterval) || m_refreshNow) { if (m_syncPaused && !m_rangeSyncActive) { - bool shouldScanMempool = m_refreshNow; + bool shouldScanMempool = m_refreshNow || m_scanMempoolWhenPaused; if (shouldScanMempool) { if (m_wallet2->get_daemon_address().empty()) { @@ -698,12 +698,28 @@ void Wallet::setSyncPaused(bool paused) { m_syncPaused = paused; if (paused) { pauseRefresh(); + if (!m_scanMempoolWhenPaused) { + m_wallet2->set_offline(true); + } } else { m_wallet2->set_offline(false); startRefresh(true); } } +void Wallet::setScanMempoolWhenPaused(bool enabled) { + m_scanMempoolWhenPaused = enabled; + + // Immediately trigger a scan if enabled and paused + if (enabled && m_syncPaused) { + m_wallet2->set_offline(false); + startRefresh(true); + } + else if (!enabled && m_syncPaused) { + m_wallet2->set_offline(true); + } +} + QDateTime Wallet::lastSyncTime() const { return m_lastSyncTime; } diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index 4da2a85f..ee9a27a9 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -225,6 +225,10 @@ public: void pauseRefresh(); Q_INVOKABLE void updateNetworkStatus(); + bool syncPaused() const; + void setSyncPaused(bool paused); + void setScanMempoolWhenPaused(bool enabled); + //! returns current wallet's block height //! (can be less than daemon's blockchain height when wallet sync in progress) quint64 blockChainHeight() const; @@ -549,6 +553,7 @@ private: std::atomic m_syncPaused{false}; std::atomic m_lastRefreshTime{0}; std::atomic m_refreshThreadStarted{false}; + std::atomic m_scanMempoolWhenPaused{false}; }; #endif // FEATHER_WALLET_H