Skip to content

Commit a2ae766

Browse files
committed
Merge #15098: qt: Show addresses for "SendToSelf" transactions
11fdfcf Show addresses for "SendToSelf" transactions (Hennadii Stepanov) Pull request description: Fix #11464 Fix #12688 Ref: #11471 by jonasschnelli Note: change addresses are not recognized (ref: bitcoin/bitcoin#11471 (comment)) Result: ![screenshot from 2019-01-04 09-06-12](https://user-images.githubusercontent.com/32963518/50677356-19c79500-1002-11e9-986c-999c366e4b2a.png) ACKs for top commit: jonasschnelli: Tested ACK 11fdfcf fanquake: ACK 11fdfcf - did the bare minimum testing. Tree-SHA512: 2678a2fdf017c376750c73fdc751b7838b0d3a970ba02e9032e4c5824494362672036c3ebf87b425aefdfe197fb952b70e4b7b6011077abb39a8bfc1ae14dfd2
2 parents 1c11e53 + 11fdfcf commit a2ae766

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/qt/transactionrecord.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,14 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
9393
if (fAllFromMe && fAllToMe)
9494
{
9595
// Payment to self
96-
CAmount nChange = wtx.change;
96+
std::string address;
97+
for (auto it = wtx.txout_address.begin(); it != wtx.txout_address.end(); ++it) {
98+
if (it != wtx.txout_address.begin()) address += ", ";
99+
address += EncodeDestination(*it);
100+
}
97101

98-
parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "",
99-
-(nDebit - nChange), nCredit - nChange));
102+
CAmount nChange = wtx.change;
103+
parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, address, -(nDebit - nChange), nCredit - nChange));
100104
parts.last().involvesWatchAddress = involvesWatchAddress; // maybe pass to TransactionRecord as constructor argument
101105
}
102106
else if (fAllFromMe)

src/qt/transactiontablemodel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, b
394394
case TransactionRecord::SendToOther:
395395
return QString::fromStdString(wtx->address) + watchAddress;
396396
case TransactionRecord::SendToSelf:
397+
return lookupAddress(wtx->address, tooltip) + watchAddress;
397398
default:
398399
return tr("(n/a)") + watchAddress;
399400
}

0 commit comments

Comments
 (0)