From 8b864e05ac000ba42a050393e839cabd09070797 Mon Sep 17 00:00:00 2001 From: adityapk00 Date: Sun, 3 Feb 2019 19:35:36 -0800 Subject: [PATCH] https://github.com/adityapk00/zqwandroid/issues/2 - Refuse to send Tx when node is syncing --- src/websockets.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/websockets.cpp b/src/websockets.cpp index 6964e82..ffd2c63 100644 --- a/src/websockets.cpp +++ b/src/websockets.cpp @@ -403,6 +403,12 @@ void AppDataServer::processSendTx(QJsonObject sendTx, MainWindow* mainwindow, QW return; }; + // Refuse to send if the node is still syncing + if (Settings::getInstance()->isSyncing()) { + error(QObject::tr("Node is still syncing.")); + return; + } + // Create a Tx Object Tx tx; tx.fee = Settings::getMinerFee(); @@ -412,7 +418,7 @@ void AppDataServer::processSendTx(QJsonObject sendTx, MainWindow* mainwindow, QW auto allBalances = mainwindow->getRPC()->getAllBalances(); QList> bals; for (auto i : allBalances->keys()) { - // Filter out sprout Txns + // Filter out sprout addresses if (Settings::getInstance()->isSproutAddress(i)) continue; // Filter out balances that don't have the requisite amount @@ -423,7 +429,7 @@ void AppDataServer::processSendTx(QJsonObject sendTx, MainWindow* mainwindow, QW } if (bals.isEmpty()) { - error("No sapling or transparent addresses with enough balance to spend."); + error(QObject::tr("No sapling or transparent addresses with enough balance to spend.")); return; }