From e2eb8e4ed39825ea6b20f93b99f2a05a7fbbf42b Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 3 May 2024 12:15:51 +0200 Subject: [PATCH] send, coins: don't allow tx construction during blockchain sync --- src/CoinsWidget.cpp | 12 ++++++++++++ src/libwalletqt/Wallet.cpp | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/CoinsWidget.cpp b/src/CoinsWidget.cpp index f592ef12..9c582da4 100644 --- a/src/CoinsWidget.cpp +++ b/src/CoinsWidget.cpp @@ -212,6 +212,18 @@ void CoinsWidget::viewOutput() { } void CoinsWidget::onSweepOutputs() { + if (!m_wallet->isConnected()) { + Utils::showError(this, "Unable to create transaction", "Wallet is not connected to a node.", + {"Wait for the wallet to automatically connect to a node.", "Go to File -> Settings -> Network -> Node to manually connect to a node."}, + "nodes"); + return; + } + + if (!m_wallet->isSynchronized()) { + Utils::showError(this, "Unable to create transaction", "Wallet is not synchronized", {"Wait for wallet synchronization to complete"}, "synchronization"); + return; + } + QVector selectedCoins = this->currentEntries(); QVector keyImages; diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index c5eb5a8b..8a457640 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -487,7 +487,7 @@ void Wallet::onHeightsRefreshed(bool success, quint64 daemonHeight, quint64 targ this->syncStatusUpdated(walletHeight, daemonHeight); } - if (walletHeight < (daemonHeight - 1)) { + if (walletHeight < (targetHeight - 1)) { setConnectionStatus(ConnectionStatus_Synchronizing); } else { setConnectionStatus(ConnectionStatus_Synchronized); -- 2.52.0