]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
TxImportDialog: check if we have tx, check if tx import was successful
authortobtoht <thotbot@protonmail.com>
Sun, 5 Sep 2021 18:13:37 +0000 (20:13 +0200)
committertobtoht <thotbot@protonmail.com>
Wed, 15 Sep 2021 21:47:05 +0000 (23:47 +0200)
CMakeLists.txt
src/dialog/TxImportDialog.cpp
src/libwalletqt/Wallet.cpp
src/libwalletqt/Wallet.h

index a584f3f9571ab4f8d6a8d3e88cdc054580a949bd..9dc76b96cf793956b97d8b066e226154cabb957f 100644 (file)
@@ -32,7 +32,7 @@ if(DEBUG)
     set(CMAKE_VERBOSE_MAKEFILE ON)
 endif()
 
-set(MONERO_HEAD "13fa706d276fb896a7221b5580cf61a04b59ed0e")
+set(MONERO_HEAD "d4257af2e7503fc6dc09fc704606230d353a0a02")
 set(BUILD_GUI_DEPS ON)
 option(ARCH "Target architecture" "x86-64")
 set(BUILD_64 ON)
index 60cf6ab491e1f8b7ce820f43d0557f2882fea639..2a00bcc7025433a8fa77a2e8e123ae0121fefb3b 100644 (file)
@@ -35,6 +35,14 @@ TxImportDialog::TxImportDialog(QWidget *parent, QSharedPointer<AppContext> ctx)
 
 void TxImportDialog::loadTx() {
     QString txid = ui->line_txid->text();
+
+    if (m_ctx->wallet->haveTransaction(txid)) {
+        QMessageBox::warning(this, "Warning", "This transaction already exists in the wallet. "
+                                              "If you can't find it in your history, "
+                                              "check if it belongs to a different account (Wallet -> Account)");
+        return;
+    }
+
     FeatherNode node = m_ctx->nodes->connection();
 
     if (node.isLocal()) {
@@ -94,6 +102,10 @@ void TxImportDialog::onImport() {
     bool double_spend_seen = tx.value("double_spend_seen").toBool();
 
     if (m_ctx->wallet->importTransaction(tx.value("tx_hash").toString(), output_indices, height, timestamp, false, pool, double_spend_seen)) {
+        if (!m_ctx->wallet->haveTransaction(txid)) {
+            QMessageBox::warning(this, "Import transaction", "This transaction does not belong to this wallet.");
+            return;
+        }
         QMessageBox::information(this, "Import transaction", "Transaction imported successfully.");
     } else {
         QMessageBox::warning(this, "Import transaction", "Transaction import failed.");
index 98d0d9da8093065ec4c35e3845b2010a57580a24..f0dd9f38cbe44546de50760c79e85a84aed2c2e3 100644 (file)
@@ -601,6 +601,11 @@ QString Wallet::printScannedPoolTxs()
     return QString::fromStdString(m_walletImpl->printScannedPoolTxs());
 }
 
+bool Wallet::haveTransaction(const QString &txid)
+{
+    return m_walletImpl->haveTransaction(txid.toStdString());
+}
+
 void Wallet::startRefresh()
 {
     m_refreshEnabled = true;
index 49e44eb8a8b05f02ebabd11293a9c3905d44ecc2..1e419450f96d7698c44c5813c2c385a04fd50ca9 100644 (file)
@@ -246,6 +246,9 @@ public:
     QString printAddressBook();
     QString printScannedPoolTxs();
 
+    //! does wallet have txid
+    bool haveTransaction(const QString &txid);
+
     //! refreshes the wallet
     bool refresh(bool historyAndSubaddresses = false);