From cfa96e81262a6795e96d5e2288d133baa542afee Mon Sep 17 00:00:00 2001 From: tobtoht Date: Mon, 28 Jun 2021 17:30:08 +0200 Subject: [PATCH] TxConfAdv: label dummy outputs --- src/dialog/TxConfAdvDialog.cpp | 2 +- src/dialog/TxInfoDialog.cpp | 2 +- src/utils/utils.cpp | 15 ++++++++------- src/utils/utils.h | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/dialog/TxConfAdvDialog.cpp b/src/dialog/TxConfAdvDialog.cpp index cbf0e91..ea88dc1 100644 --- a/src/dialog/TxConfAdvDialog.cpp +++ b/src/dialog/TxConfAdvDialog.cpp @@ -110,7 +110,7 @@ void TxConfAdvDialog::setupConstructionData(ConstructionInfo *ci) { auto address = o->address(); auto amount = WalletManager::displayAmount(o->amount()); auto index = m_ctx->wallet->subaddressIndex(address); - cursor.insertText(address, Utils::addressTextFormat(index)); + cursor.insertText(address, Utils::addressTextFormat(index, o->amount())); cursor.insertText(QString(" %1").arg(amount), QTextCharFormat()); cursor.insertBlock(); } diff --git a/src/dialog/TxInfoDialog.cpp b/src/dialog/TxInfoDialog.cpp index 8a115d9..a056d11 100644 --- a/src/dialog/TxInfoDialog.cpp +++ b/src/dialog/TxInfoDialog.cpp @@ -52,7 +52,7 @@ TxInfoDialog::TxInfoDialog(QSharedPointer ctx, TransactionInfo *txIn auto address = transfer->address(); auto amount = WalletManager::displayAmount(transfer->amount()); auto index = m_ctx->wallet->subaddressIndex(address); - cursor.insertText(address, Utils::addressTextFormat(index)); + cursor.insertText(address, Utils::addressTextFormat(index, transfer->amount())); cursor.insertText(QString(" %1").arg(amount), QTextCharFormat()); cursor.insertBlock(); } diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index 78fc830..fde1eee 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -453,20 +453,21 @@ int Utils::maxLength(const QVector &array) { return maxLength; } -QTextCharFormat Utils::addressTextFormat(const SubaddressIndex &index) { +QTextCharFormat Utils::addressTextFormat(const SubaddressIndex &index, quint64 amount) { + QTextCharFormat rec; if (index.isPrimary()) { - QTextCharFormat rec; rec.setBackground(QBrush(ColorScheme::YELLOW.asColor(true))); rec.setToolTip("Wallet change/primary address"); - return rec; } - if (index.isValid()) { - QTextCharFormat rec; + else if (index.isValid()) { rec.setBackground(QBrush(ColorScheme::GREEN.asColor(true))); rec.setToolTip("Wallet receive address"); - return rec; } - return QTextCharFormat(); + else if (amount == 0) { + rec.setBackground(QBrush(ColorScheme::GRAY.asColor(true))); + rec.setToolTip("Dummy output (Min. 2 outs consensus rule)"); + } + return rec; } bool Utils::isTorsocks() { diff --git a/src/utils/utils.h b/src/utils/utils.h index 7b88b8d..e99f36d 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -75,7 +75,7 @@ public: static QString amountToCurrencyString(double amount, const QString ¤cyCode); static int maxLength(const QVector &array); static QMap localeCache; - static QTextCharFormat addressTextFormat(const SubaddressIndex &index); + static QTextCharFormat addressTextFormat(const SubaddressIndex &index, quint64 amount); static bool isTorsocks(); static QString defaultWalletDir();