qt: Fix labels in transaction list (#3993)

* 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 <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
This commit is contained in:
UdjinM6 2021-02-11 19:36:09 +03:00 committed by GitHub
parent 899c124c76
commit 260cc09de2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -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;
@ -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
{

View File

@ -4,7 +4,6 @@
#include <qt/transactiontablemodel.h>
#include <qt/addresstablemodel.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/transactiondesc.h>
@ -205,6 +204,15 @@ public:
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;
}
@ -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: