aboutsummaryrefslogtreecommitdiff
path: root/src/qt/transactiondesc.cpp
diff options
context:
space:
mode:
authorCozz Lovan <cozzlovan@yahoo.com>2014-05-28 01:38:40 +0200
committerCozz Lovan <cozzlovan@yahoo.com>2014-05-28 01:38:40 +0200
commitb90711cabffa8bf83ddee98cfc179c0aef5732ef (patch)
tree1d9e9d473b93d31f04aa0c9f358b846112788544 /src/qt/transactiondesc.cpp
parentbdc7f1a1018002bf83991160a270c84d04e1d213 (diff)
downloadbitcoin-b90711cabffa8bf83ddee98cfc179c0aef5732ef.tar.xz
[Qt] Fix Transaction details shows wrong To:
Diffstat (limited to 'src/qt/transactiondesc.cpp')
-rw-r--r--src/qt/transactiondesc.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp
index 45fb3d40c2..0cfcb048c8 100644
--- a/src/qt/transactiondesc.cpp
+++ b/src/qt/transactiondesc.cpp
@@ -42,7 +42,7 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
}
}
-QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, int vout, int unit)
+QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionRecord *rec, int unit)
{
QString strHTML;
@@ -86,26 +86,19 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, int vout, int u
if (nNet > 0)
{
// Credit
- BOOST_FOREACH(const CTxOut& txout, wtx.vout)
+ if (CBitcoinAddress(rec->address).IsValid())
{
- if (wallet->IsMine(txout))
+ CTxDestination address = CBitcoinAddress(rec->address).Get();
+ if (wallet->mapAddressBook.count(address))
{
- CTxDestination address;
- if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address))
- {
- if (wallet->mapAddressBook.count(address))
- {
- strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
- strHTML += "<b>" + tr("To") + ":</b> ";
- strHTML += GUIUtil::HtmlEscape(CBitcoinAddress(address).ToString());
- if (!wallet->mapAddressBook[address].name.empty())
- strHTML += " (" + tr("own address") + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + ")";
- else
- strHTML += " (" + tr("own address") + ")";
- strHTML += "<br>";
- }
- }
- break;
+ strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
+ strHTML += "<b>" + tr("To") + ":</b> ";
+ strHTML += GUIUtil::HtmlEscape(rec->address);
+ if (!wallet->mapAddressBook[address].name.empty())
+ strHTML += " (" + tr("own address") + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + ")";
+ else
+ strHTML += " (" + tr("own address") + ")";
+ strHTML += "<br>";
}
}
}
@@ -224,7 +217,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, int vout, int u
if (wtx.mapValue.count("comment") && !wtx.mapValue["comment"].empty())
strHTML += "<br><b>" + tr("Comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
- strHTML += "<b>" + tr("Transaction ID") + ":</b> " + TransactionRecord::formatSubTxId(wtx.GetHash(), vout) + "<br>";
+ strHTML += "<b>" + tr("Transaction ID") + ":</b> " + TransactionRecord::formatSubTxId(wtx.GetHash(), rec->idx) + "<br>";
// Message from normal bitcoin:URI (bitcoin:123...?message=example)
foreach (const PAIRTYPE(string, string)& r, wtx.vOrderForm)