]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
txinfo: warn if integrated address is missing
authortobtoht <tob@featherwallet.org>
Sun, 6 Oct 2024 15:19:45 +0000 (17:19 +0200)
committertobtoht <tob@featherwallet.org>
Sun, 6 Oct 2024 15:43:02 +0000 (17:43 +0200)
monero
src/dialog/TxInfoDialog.cpp
src/dialog/TxInfoDialog.ui
src/libwalletqt/TransactionHistory.cpp
src/libwalletqt/rows/TransactionRow.cpp
src/libwalletqt/rows/TransactionRow.h

diff --git a/monero b/monero
index 16e051c8a880a63aacdd217f24c55f9f6154bb00..d50ba728d79cc3a96c928f7736503268ad567cba 160000 (submodule)
--- a/monero
+++ b/monero
@@ -1 +1 @@
-Subproject commit 16e051c8a880a63aacdd217f24c55f9f6154bb00
+Subproject commit d50ba728d79cc3a96c928f7736503268ad567cba
index e014cb101c48a03105e18c41c1dc51971ebab954..a9cd5b6b9cff32751cb115a7202a0c9999417990 100644 (file)
@@ -70,10 +70,14 @@ TxInfoDialog::TxInfoDialog(Wallet *wallet, TransactionRow *txInfo, QWidget *pare
     ui->frameInputs->hide();
 //    }
 
+    ui->frame_destinationsWarning->hide();
+
     QTextCursor cursor = ui->outputs->textCursor();
 
     auto transfers = txInfo->transfers();
     if (!transfers.isEmpty()) {
+        bool hasIntegrated = false;
+
         for (const auto& transfer : transfers) {
             auto address = transfer->address();
             auto amount = WalletManager::displayAmount(transfer->amount());
@@ -81,9 +85,21 @@ TxInfoDialog::TxInfoDialog(Wallet *wallet, TransactionRow *txInfo, QWidget *pare
             cursor.insertText(address, Utils::addressTextFormat(index, transfer->amount()));
             cursor.insertText(QString(" %1").arg(amount), QTextCharFormat());
             cursor.insertBlock();
+
+            if (WalletManager::baseAddressFromIntegratedAddress(transfer->address(), constants::networkType) != transfer->address()) {
+                hasIntegrated = true;
+            }
         }
         ui->label_outputs->setText(QString("Destinations (%2)").arg(QString::number(transfers.size())));
         this->adjustHeight(ui->outputs, transfers.size());
+
+        // Trezor saves a mangled payment ID.
+        if (m_wallet->isTrezor() && !hasIntegrated && txInfo->hasPaymentId()) {
+            ui->frame_destinationsWarning->setInfo(icons()->icon("warning"), "The address displayed here does not contain a payment ID. "
+                                                                             "If you are making a repeat payment to a service, "
+                                                                             "do not copy the address from here to prevent a loss of funds.");
+            ui->frame_destinationsWarning->show();
+        }
     } else {
         ui->frameOutputs->hide();
     }
index 22405d9244e7df88687a04aa314b5a3864b6c2bd..ca9cecdabf96861f14c0006d362f9574653c8f3e 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>929</width>
-    <height>715</height>
+    <height>723</height>
    </rect>
   </property>
   <property name="windowTitle">
         </property>
        </widget>
       </item>
+      <item>
+       <widget class="InfoFrame" name="frame_destinationsWarning">
+        <property name="frameShape">
+         <enum>QFrame::StyledPanel</enum>
+        </property>
+        <property name="frameShadow">
+         <enum>QFrame::Raised</enum>
+        </property>
+       </widget>
+      </item>
       <item>
        <widget class="QTextEdit" name="outputs">
         <property name="sizePolicy">
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>InfoFrame</class>
+   <extends>QFrame</extends>
+   <header>components.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>
index 905af2df0cbf677f417dc425721464998d352ef7..064352d0d17cc3f760f1c3ab0e39021db9be859b 100644 (file)
@@ -75,10 +75,10 @@ void TransactionHistory::refresh()
         clearRows();
 
         quint64 lastTxHeight = 0;
+        bool hasFakePaymentId = m_wallet->isTrezor();
         m_locked = false;
         m_minutesToUnlock = 0;
 
-
         uint64_t min_height = 0;
         uint64_t max_height = (uint64_t)-1;
         uint64_t wallet_height = m_wallet->blockChainHeight();
@@ -176,7 +176,7 @@ void TransactionHistory::refresh()
             // single output transaction might contain multiple transfers
             for (auto const &d: pd.m_dests)
             {
-                Transfer *transfer = new Transfer(d.amount, QString::fromStdString(d.address(m_wallet2->nettype(), pd.m_payment_id)), this);
+                Transfer *transfer = new Transfer(d.amount, QString::fromStdString(d.address(m_wallet2->nettype(), pd.m_payment_id, !hasFakePaymentId)), this);
                 t->m_transfers.append(transfer);
             }
             for (auto const &r: pd.m_rings)
@@ -229,7 +229,7 @@ void TransactionHistory::refresh()
 
             for (auto const &d: pd.m_dests)
             {
-                Transfer *transfer = new Transfer(d.amount, QString::fromStdString(d.address(m_wallet2->nettype(), pd.m_payment_id)), this);
+                Transfer *transfer = new Transfer(d.amount, QString::fromStdString(d.address(m_wallet2->nettype(), pd.m_payment_id, !hasFakePaymentId)), this);
                 t->m_transfers.append(transfer);
             }
             for (auto const &r: pd.m_rings)
index 0edb315b1a3a27272dd15fe4ceffe1e395cdf2d5..ff6ab3060db5c130e8601de6e874eda4fdd6c0db 100644 (file)
@@ -167,6 +167,10 @@ QString TransactionRow::rings_formatted() const
     return rings;
 }
 
+bool TransactionRow::hasPaymentId() const {
+    return m_paymentId != "0000000000000000";
+}
+
 TransactionRow::~TransactionRow()
 {
     qDeleteAll(m_transfers);
index 68b21e22521a06df79b36df440f153ef9a2d3d62..34d6f58b61e51bd6a6453da6b73ca6a06e25bd7c 100644 (file)
@@ -52,6 +52,7 @@ public:
     QList<QString> destinations() const;
     QList<Transfer*> transfers() const;
     QString rings_formatted() const;
+    bool hasPaymentId() const;
 
 private:
     explicit TransactionRow(QObject *parent);