]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
keep simplifying pause sync stuff
authorgg <chown_tee@proton.me>
Wed, 14 Jan 2026 14:57:18 +0000 (09:57 -0500)
committergg <chown_tee@proton.me>
Wed, 14 Jan 2026 15:07:34 +0000 (10:07 -0500)
src/MainWindow.cpp
src/MainWindow.h
src/libwalletqt/Wallet.cpp
src/utils/Utils.cpp
src/utils/Utils.h
src/utils/config.cpp
src/utils/config.h
src/utils/nodes.cpp

index 9caf3f5e4e293f5655de9f045c4d4214a84f7d95..242d1de9dc615c7f6213a4af0c738a5353996c93 100644 (file)
@@ -221,12 +221,6 @@ void MainWindow::initStatusBar() {
     pauseSyncAction->setChecked(conf()->get(Config::syncPaused).toBool());
     m_statusLabelStatus->addAction(pauseSyncAction);
 
-    m_actionDisconnectNodeOnPause = new QAction(tr("Disconnect from Node"), this);
-    m_actionDisconnectNodeOnPause->setCheckable(true);
-    m_actionDisconnectNodeOnPause->setChecked(conf()->get(Config::syncPausedAlsoDisconnectNode).toBool());
-    m_actionDisconnectNodeOnPause->setEnabled(pauseSyncAction->isChecked());
-    m_statusLabelStatus->addAction(m_actionDisconnectNodeOnPause);
-
     m_actionEnableWebsocket = new QAction(tr("Enable Websocket"), this);
     m_actionEnableWebsocket->setCheckable(true);
     m_actionEnableWebsocket->setChecked(!conf()->get(Config::disableWebsocket).toBool());
@@ -242,9 +236,6 @@ void MainWindow::initStatusBar() {
         WindowManager::instance()->onWebsocketStatusChanged(checked);
     });
 
-    connect(m_actionDisconnectNodeOnPause, &QAction::toggled, this, [](bool checked){
-        conf()->set(Config::syncPausedAlsoDisconnectNode, checked);
-    });
 
     QAction *skipSyncAction = new QAction(tr("Skip Sync"), this);
     m_statusLabelStatus->addAction(skipSyncAction);
@@ -266,20 +257,13 @@ void MainWindow::initStatusBar() {
         qInfo() << "Pause Sync toggled. Checked =" << checked;
         conf()->set(Config::syncPaused, checked);
 
-        m_actionDisconnectNodeOnPause->setEnabled(checked);
         m_updateNetworkInfoAction->setEnabled(!checked);
 
         if (m_wallet) {
             if (checked) {
                 m_wallet->setSyncPaused(true);
-
-                if (m_actionDisconnectNodeOnPause->isChecked()) {
-                     qInfo() << "Disconnecting from node (Pause Sync enabled)";
-                     m_nodes->disconnectCurrentNode();
-                     this->onConnectionStatusChanged(Wallet::ConnectionStatus_Disconnected);
-                }
-
-                this->setPausedSyncStatus();
+                m_nodes->disconnectCurrentNode();
+                this->onConnectionStatusChanged(Wallet::ConnectionStatus_Disconnected);
             } else {
                 // Ensure we reconnect everything when unpausing
                 m_wallet->setSyncPaused(false);
@@ -711,12 +695,6 @@ void MainWindow::initOffline() {
         m_wallet->updateNetworkStatus();
     });
 
-    connect(m_wallet, &Wallet::heightsRefreshed, this, [this](bool success, quint64 daemonHeight, quint64 targetHeight) {
-        if (conf()->get(Config::syncPaused).toBool()) {
-            qDebug() << "Heights refreshed (Paused): Daemon" << daemonHeight << "Target" << targetHeight;
-            this->setPausedSyncStatus();
-        }
-    });
 
     // We do NOT want to start syncing yet here, wait for wallet to be opened
     // We can't use rich text for radio buttons
@@ -757,16 +735,6 @@ void MainWindow::initWalletContext() {
         this->updateBalance();
     });
 
-    connect(m_wallet, &Wallet::heightsRefreshed, this, [this](bool success, quint64 daemonHeight, quint64 targetHeight) {
-        // When paused, we might get success=false because wallet->refresh() is skipped,
-        // preventing strict cache updates. We should attempt to fallback to m_nodes info.
-        if (!success && !conf()->get(Config::syncPaused).toBool()) return;
-
-        // Update sync estimate if paused
-        if (conf()->get(Config::syncPaused).toBool()) {
-             this->setPausedSyncStatus();
-        }
-    });
     connect(m_wallet, &Wallet::currentSubaddressAccountChanged, this, &MainWindow::updateTitle);
     connect(m_wallet, &Wallet::walletPassphraseNeeded, this, &MainWindow::onWalletPassphraseNeeded);
 
@@ -871,7 +839,6 @@ void MainWindow::onWalletOpened() {
     if (!conf()->get(Config::disableAutoRefresh).toBool()) {
         if (conf()->get(Config::syncPaused).toBool()) {
             m_wallet->setSyncPaused(true);
-            this->setPausedSyncStatus();
         }
         m_nodes->connectToNode();
     }
@@ -943,27 +910,6 @@ void MainWindow::onBalanceUpdated(quint64 balance, quint64 spendable) {
     m_statusLabelBalance->setProperty("copyableValue", valueStr);
 }
 
-void MainWindow::setPausedSyncStatus() {
-    qDebug() << "setPausedSyncStatus called. Sync paused:" << conf()->get(Config::syncPaused).toBool();
-    QString tooltip;
-    QString status = Utils::getPausedSyncStatus(m_wallet, m_nodes, &tooltip);
-
-    if (m_wallet) {
-        quint64 daemonHeight = m_wallet->daemonBlockChainHeight();
-        quint64 walletHeight = m_wallet->blockChainHeight();
-        quint64 targetHeight = m_wallet->daemonBlockChainTargetHeight();
-        quint64 blocksBehind = Utils::blocksBehind(walletHeight, targetHeight);
-
-        qDebug() << "Paused Status Calc: WalletHeight:" << walletHeight
-                 << "DaemonHeight:" << daemonHeight
-                 << "TargetHeight:" << targetHeight
-                 << "BlocksBehind:" << blocksBehind;
-    }
-
-    this->setStatusText(status);
-    if (!tooltip.isEmpty())
-        m_statusLabelStatus->setToolTip(tooltip);
-}
 
 void MainWindow::setStatusText(const QString &text, bool override, int timeout) {
 
@@ -1165,14 +1111,6 @@ void MainWindow::onConnectionStatusChanged(int status)
 
     m_statusBtnConnectionStatusIndicator->setToolTip(statusStr);
 
-    if (conf()->get(Config::syncPaused).toBool() && !conf()->get(Config::offlineMode).toBool()) {
-        if (status == Wallet::ConnectionStatus_Synchronizing 
-            || status == Wallet::ConnectionStatus_Synchronized 
-            || status == Wallet::ConnectionStatus_Connecting) {
-            this->setPausedSyncStatus();
-            icon = icons()->icon("status_lagging.svg");
-        }
-    }
     m_statusBtnConnectionStatusIndicator->setIcon(icon);
 }
 
@@ -1875,7 +1813,6 @@ void MainWindow::onDeviceError(const QString &error, quint64 errorCode) {
         }
     }
     m_statusBtnHwDevice->setIcon(this->hardwareDevicePairedIcon());
-    m_wallet->setSyncPaused(conf()->get(Config::syncPaused).toBool());
     m_showDeviceError = false;
 }
 
index 2392392469d9c73db6ed0ed4e2ba9ed3c31984ba..d5d1a862bab61d89b0c12aa7cad2621eb9e03f7e 100644 (file)
@@ -211,7 +211,6 @@ private:
     void unlockWallet(const QString &password);
     void closeQDialogChildren(QObject *object);
     int findTab(const QString &title);
-    void setPausedSyncStatus();
 
     QIcon hardwareDevicePairedIcon();
     QIcon hardwareDeviceUnpairedIcon();
@@ -235,7 +234,6 @@ private:
 
     QPointer<QAction> m_clearRecentlyOpenAction;
     QPointer<QAction> m_updateNetworkInfoAction;
-    QPointer<QAction> m_actionDisconnectNodeOnPause;
     QPointer<QAction> m_actionEnableWebsocket;
 
     QDateTime m_lastSyncStatusUpdate;
index 5d9905e01864ebf402e32f619276b89e07fb47a3..8aadcb813f3ba68f6f1b96b691a0ec82ea307aa7 100644 (file)
@@ -550,20 +550,6 @@ void Wallet::onHeightsRefreshed(bool success, quint64 daemonHeight, quint64 targ
     m_daemonBlockChainHeight = daemonHeight;
     m_daemonBlockChainTargetHeight = targetHeight;
 
-    if (conf()->get(Config::syncPaused).toBool()) {
-        if (success) {
-            quint64 walletHeight = blockChainHeight();
-            if (walletHeight < (targetHeight - 1)) {
-                setConnectionStatus(ConnectionStatus_Synchronizing);
-            } else {
-                setConnectionStatus(ConnectionStatus_Synchronized);
-            }
-        } else {
-             setConnectionStatus(ConnectionStatus_Disconnected);
-        }
-        return;
-    }
-
     if (success) {
         quint64 walletHeight = blockChainHeight();
 
@@ -720,7 +706,7 @@ bool Wallet::importTransaction(const QString &txid) {
 }
 
 void Wallet::onNewBlock(uint64_t walletHeight) {
-    if (conf()->get(Config::syncPaused).toBool()) {
+    if (m_syncPaused) {
         return;
     }
     // Called whenever a new block gets scanned by the wallet
index 556e6cb08639626a06fbd5e0898d625a9c53966d..d037390fddc661354452209582aa42910d05557c 100644 (file)
@@ -777,44 +777,6 @@ quint64 estimateSyncDataSize(quint64 blocks) {
     return blocks * 30 * 1024;
 }
 
-QString formatPausedSyncStatus(quint64 blocks) {
-    QString blocksStr = QLocale().toString(blocks);
-    return QObject::tr("[PAUSED] %1 blocks behind").arg(blocksStr);
-}
-
-QString getPausedSyncStatus(Wallet *wallet, Nodes *nodes, QString *tooltip) {
-    if (!wallet) return QObject::tr("[PAUSED] Sync paused");
-
-    quint64 walletHeight = wallet->blockChainHeight();
-    quint64 creationHeight = wallet->getWalletCreationHeight();
-    quint64 startHeight = (walletHeight > creationHeight) ? walletHeight : creationHeight;
-    quint64 daemonHeight = wallet->daemonBlockChainTargetHeight();
-    if (daemonHeight == 0) {
-        daemonHeight = wallet->daemonBlockChainHeight();
-    }
-
-    // If sync is paused or wallet just started, Wallet's internal height might be 0.
-    // If the daemon is connected, use its target_height or height to determine the latest tip.
-    if (daemonHeight == 0 && nodes) {
-        auto connection = nodes->connection();
-        if (connection.target_height > 0) daemonHeight = connection.target_height;
-        else if (connection.height > 0) daemonHeight = connection.height;
-    }
-
-    if (daemonHeight > 0) {
-        if (tooltip) {
-            *tooltip = QObject::tr("Wallet Height: %1 | Network Tip: %2").arg(walletHeight).arg(daemonHeight);
-        }
-        quint64 blocksBehind = Utils::blocksBehind(startHeight, daemonHeight);
-        if (blocksBehind == 0) {
-            return QObject::tr("[PAUSED] Sync paused");
-        }
-        return formatPausedSyncStatus(blocksBehind);
-    } 
-    
-    return QObject::tr("[PAUSED] Sync paused");
-}
-
 QString formatRestoreHeight(quint64 height) {
     const QDateTime restoreDate = appData()->restoreHeights[constants::networkType]->heightToDate(height);
     return QString("%1  (%2)").arg(QString::number(height), restoreDate.toString("yyyy-MM-dd"));
index ae2467dfc121eb414e95fe5908dfefd17fb00975..f4aa611827637baa0555d5da502eccb276f80b5a 100644 (file)
@@ -125,8 +125,6 @@ namespace Utils
     QString formatSyncStatus(quint64 height, quint64 target, bool daemonSync = false);
     QString formatSyncTimeEstimate(quint64 blocks);
     quint64 estimateSyncDataSize(quint64 blocks);
-    QString formatPausedSyncStatus(quint64 blocks);
-    QString getPausedSyncStatus(Wallet *wallet, Nodes *nodes, QString *tooltip = nullptr);
     QString formatRestoreHeight(quint64 height);
 
     QString getVersion();
index 71a66c29fd3c7af7c9f5e5da9f777b2bc6eecc04..3250b8b99db514a02e78400edfa52494329e65d4 100644 (file)
@@ -80,7 +80,6 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
         {Config::disableAutoRefresh, {QS("disableAutoRefresh"), false}},
         {Config::offlineMode, {QS("offlineMode"), false}},
         {Config::syncPaused, {QS("syncPaused"), false}},
-        {Config::syncPausedAlsoDisconnectNode, {QS("syncPausedAlsoDisconnectNode"), false}},
         {Config::syncPausedAlsoDisconnectWebSocket, {QS("syncPausedAlsoDisconnectWebSocket"), false}},
 
         // Transactions
index 31ab8f60bea270da5ac531190b785e4115af44a0..462c2a5c93b02875eac941397f7e3e2612bde562 100644 (file)
@@ -145,7 +145,6 @@ public:
 
         // Sync & data saver
         syncPaused,
-        syncPausedAlsoDisconnectNode,
         syncPausedAlsoDisconnectWebSocket,
     };
 
index 396890dd659619934b34d6364bd122a30cf165d2..38dbdb74798b254341e7a8b8b7b8c32a69675655 100644 (file)
@@ -275,7 +275,7 @@ void Nodes::autoConnect(bool forceReconnect) {
         return;
     }
 
-    if (conf()->get(Config::syncPaused).toBool() && conf()->get(Config::syncPausedAlsoDisconnectNode).toBool()) {
+    if (conf()->get(Config::syncPaused).toBool()) {
         return;
     }