Skip to content

Commit

Permalink
qt: Fix labels in transaction list (#3993)
Browse files Browse the repository at this point in the history
* qt: Fix labels in transaction list

The issue was introduced in #3682

* qt: Always use labels from TransactionStatus for transaction list

Missed this in #3155

* Update src/qt/transactiontablemodel.cpp

Co-authored-by: dustinface <[email protected]>

Co-authored-by: dustinface <[email protected]>
  • Loading branch information
UdjinM6 and xdustinface authored Feb 11, 2021
1 parent 899c124 commit 260cc09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/qt/transactionrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
if(mine)
{
TransactionRecord sub(hash, nTime);
CTxDestination address;
sub.idx = i; // vout index
sub.credit = txout.nValue;
sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY;
Expand All @@ -59,7 +58,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
// Received by Dash Address
sub.type = TransactionRecord::RecvWithAddress;
sub.strAddress = EncodeDestination(wtx.txout_address[i]);
sub.txDest = address;
sub.txDest = wtx.txout_address[i];
}
else
{
Expand Down
14 changes: 11 additions & 3 deletions src/qt/transactiontablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include <qt/transactiontablemodel.h>

#include <qt/addresstablemodel.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/transactiondesc.h>
Expand Down Expand Up @@ -205,6 +204,15 @@ class TransactionTablePriv
int64_t adjustedTime;
if (rec->statusUpdateNeeded(numBlocks, parent->getChainLockHeight()) && wallet.tryGetTxStatus(rec->hash, wtx, adjustedTime)) {
rec->updateStatus(wtx, numBlocks, adjustedTime, parent->getChainLockHeight());
// Update label
if (IsValidDestination(rec->txDest)) {
std::string name;
if (wallet.getAddress(rec->txDest, &name)) {
rec->status.label = QString::fromStdString(name);
} else {
rec->status.label = "";
}
}
}
return rec;
}
Expand Down Expand Up @@ -451,9 +459,9 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const
case TransactionRecord::PrivateSend:
case TransactionRecord::RecvWithPrivateSend:
{
QString label = walletModel->getAddressTableModel()->labelForDestination(wtx->txDest);
if(label.isEmpty())
if (wtx->status.label.isEmpty()) {
return GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BAREADDRESS);
}
} break;
case TransactionRecord::SendToSelf:
case TransactionRecord::PrivateSendCreateDenominations:
Expand Down

0 comments on commit 260cc09

Please sign in to comment.