[Qt] Fix Transaction details shows wrong To:
This commit is contained in:
parent
bdc7f1a101
commit
b90711cabf
3 changed files with 16 additions and 22 deletions
|
@ -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;
|
QString strHTML;
|
||||||
|
|
||||||
|
@ -86,26 +86,19 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, int vout, int u
|
||||||
if (nNet > 0)
|
if (nNet > 0)
|
||||||
{
|
{
|
||||||
// Credit
|
// 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;
|
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
|
||||||
if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address))
|
strHTML += "<b>" + tr("To") + ":</b> ";
|
||||||
{
|
strHTML += GUIUtil::HtmlEscape(rec->address);
|
||||||
if (wallet->mapAddressBook.count(address))
|
if (!wallet->mapAddressBook[address].name.empty())
|
||||||
{
|
strHTML += " (" + tr("own address") + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + ")";
|
||||||
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
|
else
|
||||||
strHTML += "<b>" + tr("To") + ":</b> ";
|
strHTML += " (" + tr("own address") + ")";
|
||||||
strHTML += GUIUtil::HtmlEscape(CBitcoinAddress(address).ToString());
|
strHTML += "<br>";
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +217,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, int vout, int u
|
||||||
if (wtx.mapValue.count("comment") && !wtx.mapValue["comment"].empty())
|
if (wtx.mapValue.count("comment") && !wtx.mapValue["comment"].empty())
|
||||||
strHTML += "<br><b>" + tr("Comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
|
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)
|
// Message from normal bitcoin:URI (bitcoin:123...?message=example)
|
||||||
foreach (const PAIRTYPE(string, string)& r, wtx.vOrderForm)
|
foreach (const PAIRTYPE(string, string)& r, wtx.vOrderForm)
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
class TransactionRecord;
|
||||||
class CWallet;
|
class CWallet;
|
||||||
class CWalletTx;
|
class CWalletTx;
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ class TransactionDesc: public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static QString toHTML(CWallet *wallet, CWalletTx &wtx, int vout, int unit);
|
static QString toHTML(CWallet *wallet, CWalletTx &wtx, TransactionRecord *rec, int unit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TransactionDesc() {}
|
TransactionDesc() {}
|
||||||
|
|
|
@ -222,7 +222,7 @@ public:
|
||||||
std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(rec->hash);
|
std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(rec->hash);
|
||||||
if(mi != wallet->mapWallet.end())
|
if(mi != wallet->mapWallet.end())
|
||||||
{
|
{
|
||||||
return TransactionDesc::toHTML(wallet, mi->second, rec->idx, unit);
|
return TransactionDesc::toHTML(wallet, mi->second, rec, unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QString("");
|
return QString("");
|
||||||
|
|
Loading…
Reference in a new issue