]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
history: use subaddress label as default tx description
authortobtoht <tob@featherwallet.org>
Fri, 22 Dec 2023 15:08:46 +0000 (16:08 +0100)
committertobtoht <tob@featherwallet.org>
Fri, 22 Dec 2023 15:08:46 +0000 (16:08 +0100)
src/libwalletqt/TransactionHistory.cpp

index bdcddcd4dc81e21a0286b627f1da7d6308bd65b1..4e9e1fff9773db076f63bb680e5009de86563274 100644 (file)
@@ -97,7 +97,6 @@ void TransactionHistory::refresh()
             t->m_direction = TransactionRow::Direction_In;
             t->m_hash = QString::fromStdString(epee::string_tools::pod_to_hex(pd.m_tx_hash));
             t->m_blockHeight = pd.m_block_height;
-            t->m_description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash));
             t->m_subaddrIndex = { pd.m_subaddr_index.minor };
             t->m_subaddrAccount = pd.m_subaddr_index.major;
             t->m_label = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
@@ -105,6 +104,11 @@ void TransactionHistory::refresh()
             t->m_confirmations = (wallet_height > pd.m_block_height) ? wallet_height - pd.m_block_height : 0;
             t->m_unlockTime = pd.m_unlock_time;
 
+            t->m_description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash));
+            if (t->m_description.isEmpty()) {
+                t->m_description = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
+            }
+
             m_rows.append(t);
         }
 
@@ -244,7 +248,6 @@ void TransactionHistory::refresh()
             t->m_direction = TransactionRow::Direction_In;
             t->m_hash = QString::fromStdString(epee::string_tools::pod_to_hex(pd.m_tx_hash));
             t->m_blockHeight = pd.m_block_height;
-            t->m_description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash));
             t->m_pending = true;
             t->m_subaddrIndex = { pd.m_subaddr_index.minor };
             t->m_subaddrAccount = pd.m_subaddr_index.major;
@@ -252,6 +255,11 @@ void TransactionHistory::refresh()
             t->m_timestamp = QDateTime::fromSecsSinceEpoch(pd.m_timestamp);
             t->m_confirmations = 0;
 
+            t->m_description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash));
+            if (t->m_description.isEmpty()) {
+                t->m_description = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
+            }
+
             m_rows.append(t);
 
             LOG_PRINT_L1(__FUNCTION__ << ": Unconfirmed payment found " << pd.m_amount);