]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
history: add option to remove failed tx
authortobtoht <tob@featherwallet.org>
Wed, 13 Mar 2024 13:10:20 +0000 (14:10 +0100)
committertobtoht <tob@featherwallet.org>
Wed, 13 Mar 2024 13:10:20 +0000 (14:10 +0100)
monero
src/HistoryWidget.cpp
src/HistoryWidget.h
src/libwalletqt/Wallet.cpp
src/libwalletqt/Wallet.h

diff --git a/monero b/monero
index 9df7f6b7eff0a4e1c0e33539c5d9849a0e374c14..3f9cbd8c5f08e2944f5aba87ee29917821b99b8c 160000 (submodule)
--- a/monero
+++ b/monero
@@ -1 +1 @@
-Subproject commit 9df7f6b7eff0a4e1c0e33539c5d9849a0e374c14
+Subproject commit 3f9cbd8c5f08e2944f5aba87ee29917821b99b8c
index 15a3d812144652e2938381a77ead59384d1adf0c..d5e5939f440f7beb8a7dbf365110c89f38194dba 100644 (file)
@@ -90,6 +90,10 @@ void HistoryWidget::showContextMenu(const QPoint &point) {
         menu.addAction("Resend transaction", this, &HistoryWidget::onResendTransaction);
     }
 
+    if (tx->isFailed()) {
+        menu.addAction("Remove from history", this, &HistoryWidget::onRemoveFromHistory);
+    }
+
     menu.addMenu(m_copyMenu);
     menu.addAction("Show details", this, &HistoryWidget::showTxDetails);
     menu.addAction("View on block explorer", this, &HistoryWidget::onViewOnBlockExplorer);
@@ -106,6 +110,16 @@ void HistoryWidget::onResendTransaction() {
     }
 }
 
+void HistoryWidget::onRemoveFromHistory() {
+    auto *tx = ui->history->currentEntry();
+    if (!tx) return;
+
+    auto result = QMessageBox::question(this, "Remove transaction from history", "Are you sure you want to remove this transaction from the history?");
+    if (result == QMessageBox::Yes) {
+        m_wallet->removeFailedTx(tx->hash());
+    }
+}
+
 void HistoryWidget::resetModel()
 {
     // Save view state
index 3cbe144feed263b5d5fd1571b8bdda2fa9f36718..f387b07b21a6bd5591327bfb73e197d993d7aae8 100644 (file)
@@ -42,6 +42,7 @@ private slots:
     void onViewOnBlockExplorer();
     void setSearchFilter(const QString &filter);
     void onResendTransaction();
+    void onRemoveFromHistory();
     void createTxProof();
 
 private:
index f3bb3d1fc1a3d3b8457c24d56e31408ca4ce605d..507b734c0ba654d31619b54a8ab396807c4cef37 100644 (file)
@@ -1032,6 +1032,20 @@ bool Wallet::submitTxFile(const QString &fileName) const
     return m_walletImpl->importKeyImages(fileName.toStdString() + "_keyImages");
 }
 
+bool Wallet::removeFailedTx(const QString &txid)
+{
+    crypto::hash txid_;
+    if(!epee::string_tools::hex_to_pod(txid.toStdString(), txid_))
+    {
+        return false;
+    }
+
+    bool r = m_wallet2->remove_failed_tx(txid_);
+    m_history->refresh();
+
+    return r;
+}
+
 // #################### Models ####################
 
 TransactionHistory *Wallet::history() const {
index 03decd569b775446c546ea77f31c40d5ce0f378c..7dbc0380b86f5f922b42be692f14c79fb8658e11 100644 (file)
@@ -345,6 +345,8 @@ public:
     //! Submit a transfer from file
     bool submitTxFile(const QString &fileName) const;
 
+    bool removeFailedTx(const QString &txid);
+
     // ##### Models #####
     TransactionHistory* history() const;
     TransactionHistoryProxyModel* historyModel();