From 14f3caa1c5e4271597ae9830cab68fc1be2d8305 Mon Sep 17 00:00:00 2001 From: John Moffett Date: Wed, 18 Jan 2023 15:32:39 -0500 Subject: [PATCH] Show labels for multiple SendToSelf addresses Currently, the transaction table will display address labels for self-payments if there's only one recipient - ie - if you've sent your entire balance to yourself. This changes it to show labels for any addresses that have labels in the address book. --- src/qt/transactiontablemodel.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 3b32137bd41..e8179f8d931 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -424,8 +425,15 @@ QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, b return lookupAddress(wtx->address, tooltip) + watchAddress; case TransactionRecord::SendToOther: return QString::fromStdString(wtx->address) + watchAddress; - case TransactionRecord::SendToSelf: - return lookupAddress(wtx->address, tooltip) + watchAddress; + case TransactionRecord::SendToSelf: { + std::vector addresses = SplitString(wtx->address, ','); + QString display_string; + for (auto it = addresses.begin(); it != addresses.end(); ++it) { + if (it != addresses.begin()) display_string += ", "; + display_string += lookupAddress(TrimString(*it), tooltip) + watchAddress; + } + return display_string; + } default: return tr("(n/a)") + watchAddress; }