]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
better blocks behind and mempool scan logic
authorgg <chown_tee@proton.me>
Sun, 18 Jan 2026 22:12:50 +0000 (17:12 -0500)
committergg <chown_tee@proton.me>
Sun, 18 Jan 2026 22:12:50 +0000 (17:12 -0500)
src/MainWindow.cpp
src/libwalletqt/Wallet.cpp

index 6db6671dfa0cc574c2b5d1350f647d80e7df4cb9..148fb21c9c251193598d145ef69de8c4d7e17ab3 100644 (file)
@@ -888,16 +888,7 @@ void MainWindow::updateSyncStatusToolTip() {
 
     quint64 walletHeight = m_wallet->blockChainHeight();
     quint64 daemonHeight = m_wallet->daemonBlockChainHeight();
-    quint64 blocksBehind = daemonHeigh - walletHeight;
-
-    // Use time-estimation if we don't have a live connection
-    if (isPaused || m_wallet->connectionStatus() == Wallet::ConnectionStatus_Disconnected) {
-            QDateTime lastSync = m_wallet->lastSyncTime();
-            if (lastSync.isValid()) {
-                qint64 secs = lastSync.secsTo(QDateTime::currentDateTime());
-                if (secs > 0) blocksBehind = secs / 120; // 120s per block
-        }
-    }
+    quint64 blocksBehind = (daemonHeight > walletHeight) ? (daemonHeight - walletHeight) : 0;
 
     // Build tooltip
     QString tooltip = tr("Daemon Height: %1").arg(QLocale().toString(daemonHeight));
index f15b8dcbca26ca565ffe16d96fbad229cad03c69..79d9ee012732ed0b251ca90bef1336ba9f682fb4 100644 (file)
@@ -522,20 +522,23 @@ void Wallet::startRefreshThread()
                 const auto elapsed = now - last;
                 if (elapsed >= std::chrono::seconds(m_refreshInterval) || m_refreshNow)
                 {
-                    // Scan mempool if paused and user has enabled it (low-bandwidth query)
                     if (m_syncPaused) {
-                        if (m_refreshNow || conf()->get(Config::scanMempoolWhenPaused).toBool()) {
+                        bool shouldScanMempool = m_refreshNow || conf()->get(Config::scanMempoolWhenPaused).toBool();
+
+                        if (shouldScanMempool) {
                             qDebug() << "[SYNC PAUSED] Scanning mempool because scans are enabled";
-                            if (m_scheduler.stopping()) return; // TODO: do we need this?
+                            if (m_scheduler.stopping()) return;
                             scanMempool();
+                        }
 
-                            // Update network stats
+                        // Update network stats if we just scanned OR if we don't have stats yet (startup recovery)
+                        if (shouldScanMempool || m_daemonBlockChainHeight == 0) {
                             quint64 daemonHeight = m_walletImpl->daemonBlockChainHeight();
                             quint64 targetHeight = (daemonHeight > 0) ? m_walletImpl->daemonBlockChainTargetHeight() : 0;
                             emit heightsRefreshed(daemonHeight > 0, daemonHeight, targetHeight);
-
-                            m_refreshNow = false;
                         }
+
+                        m_refreshNow = false;
                         last = std::chrono::steady_clock::now();
                         continue;
                     }