diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index 5f6dd33b5f..f057ca13f1 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -274,6 +274,33 @@ QString TransactionDesc::toHTML_Amounts(interfaces::Wallet& wallet, const interf strHTML += "" + tr("Credit") + ": " + BitcoinUnits::formatHtmlWithUnit(unit, txout.nValue) + "
"; } + auto pegout_mine = wtx.pegout_is_mine.begin(); + for (const PegOutCoin& pegout : wtx.pegouts) { + isminetype toSelf = *(pegout_mine++); + if ((toSelf == ISMINE_SPENDABLE) && (fAllFromMe == ISMINE_SPENDABLE)) + continue; + + CTxDestination dest; + if (::ExtractDestination(pegout.GetScriptPubKey(), dest)) { + strHTML += "" + tr("To") + ": "; + std::string name; + if (wallet.getAddress( + dest, &name, /* is_mine= */ nullptr, /* purpose= */ nullptr) && + !name.empty()) + strHTML += GUIUtil::HtmlEscape(name) + " "; + strHTML += GUIUtil::HtmlEscape(::EncodeDestination(dest)); + if (toSelf == ISMINE_SPENDABLE) + strHTML += " (own address)"; + else if (toSelf & ISMINE_WATCH_ONLY) + strHTML += " (watch-only)"; + strHTML += "
"; + } + + strHTML += "" + tr("Debit") + ": " + BitcoinUnits::formatHtmlWithUnit(unit, -pegout.GetAmount()) + "
"; + if (toSelf) + strHTML += "" + tr("Credit") + ": " + BitcoinUnits::formatHtmlWithUnit(unit, pegout.GetAmount()) + "
"; + } + if (fAllToMe) { // Payment to self CAmount nValue = wtx.credit - wtx.change; @@ -294,6 +321,7 @@ QString TransactionDesc::toHTML_Amounts(interfaces::Wallet& wallet, const interf strHTML += "" + tr("Debit") + ": " + BitcoinUnits::formatHtmlWithUnit(unit, -wallet.getDebit(txin, ISMINE_ALL)) + "
"; } } + mine = wtx.txout_is_mine.begin(); for (const interfaces::WalletTxOut& out : wtx.outputs) { if (*(mine++)) { @@ -301,7 +329,12 @@ QString TransactionDesc::toHTML_Amounts(interfaces::Wallet& wallet, const interf } } - // MW: TODO - Pegouts? + mine = wtx.pegout_is_mine.begin(); + for (const PegOutCoin& pegout : wtx.pegouts) { + if (*(mine++)) { + strHTML += "" + tr("Credit") + ": " + BitcoinUnits::formatHtmlWithUnit(unit, pegout.GetAmount()) + "
"; + } + } } }