From 0df7e7787566b4a7219390637b318c5f7ea1eadd Mon Sep 17 00:00:00 2001 From: gg Date: Mon, 12 Jan 2026 17:36:18 -0500 Subject: [PATCH] track and emit network/pause status --- src/libwalletqt/Wallet.cpp | 17 +++++++++++++++++ src/libwalletqt/Wallet.h | 1 + src/main.cpp | 1 + 3 files changed, 19 insertions(+) diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index dc47a03f..cf1dbc12 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -459,6 +459,23 @@ void Wallet::pauseRefresh() { m_refreshEnabled = false; } +void Wallet::updateNetworkStatus() { + const auto future = m_scheduler.run([this] { + if (!isHwBacked() || isDeviceConnected()) { + quint64 daemonHeight = m_walletImpl->daemonBlockChainHeight(); + bool success = daemonHeight > 0; + + quint64 targetHeight = 0; + if (success) { + targetHeight = m_walletImpl->daemonBlockChainTargetHeight(); + } + bool haveHeights = (daemonHeight > 0 && targetHeight > 0); + + emit heightsRefreshed(haveHeights, daemonHeight, targetHeight); + } + }); +} + void Wallet::startRefreshThread() { const auto future = m_scheduler.run([this] { diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index d09604e4..0e62d0bb 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -217,6 +217,7 @@ public: // ##### Synchronization (Refresh) ##### void startRefresh(); void pauseRefresh(); + Q_INVOKABLE void updateNetworkStatus(); //! returns current wallet's block height //! (can be less than daemon's blockchain height when wallet sync in progress) diff --git a/src/main.cpp b/src/main.cpp index aa62546c..4c4912ac 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -188,6 +188,7 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) { info.emplace_back("Tor", TOR_VERSION); info.emplace_back("SSL", QSslSocket::sslLibraryVersionString()); info.emplace_back("Mode", stagenet ? "Stagenet" : (testnet ? "Testnet" : "Mainnet")); + info.emplace_back("Network", conf()->get(Config::syncPaused).toBool() ? "PAUSED" : "ACTIVE"); for (const auto &k: info) { qWarning().nospace().noquote() << QString("%1: %2").arg(k.first, k.second); -- 2.52.0