]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
TxConfAdv: label dummy outputs
authortobtoht <thotbot@protonmail.com>
Mon, 28 Jun 2021 15:30:08 +0000 (17:30 +0200)
committertobtoht <thotbot@protonmail.com>
Mon, 28 Jun 2021 15:30:08 +0000 (17:30 +0200)
src/dialog/TxConfAdvDialog.cpp
src/dialog/TxInfoDialog.cpp
src/utils/utils.cpp
src/utils/utils.h

index cbf0e91db3965cbfda632b4d72450d35a1c80ebb..ea88dc15171a1fb06a63aded1885b30ffc555c5d 100644 (file)
@@ -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();
     }
index 8a115d9829814bc2e23b0ff9079c02a39d984930..a056d11ddaaac98a0a2666e88ca4ac0c681106ed 100644 (file)
@@ -52,7 +52,7 @@ TxInfoDialog::TxInfoDialog(QSharedPointer<AppContext> 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();
     }
index 78fc8306662a343a8de0f95fe0862a9d1771fe37..fde1eee63a45404a4a55fcb80b6577c16fc0df87 100644 (file)
@@ -453,20 +453,21 @@ int Utils::maxLength(const QVector<QString> &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() {
index 7b88b8d88d9be5eb6e11b6a44e56288d53ea04ae..e99f36d143910b36e7b4715c6cc3847ff4bfa87b 100644 (file)
@@ -75,7 +75,7 @@ public:
     static QString amountToCurrencyString(double amount, const QString &currencyCode);
     static int maxLength(const QVector<QString> &array);
     static QMap<QString, QLocale> localeCache;
-    static QTextCharFormat addressTextFormat(const SubaddressIndex &index);
+    static QTextCharFormat addressTextFormat(const SubaddressIndex &index, quint64 amount);
     static bool isTorsocks();
     static QString defaultWalletDir();