Fixed some stuff in TransactionDesc
This commit is contained in:
parent
80dda36a07
commit
23b0506c91
2 changed files with 16 additions and 22 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include "timedata.h"
|
#include "timedata.h"
|
||||||
#include "ui_interface.h"
|
#include "ui_interface.h"
|
||||||
#include "wallet.h"
|
#include "wallet.h"
|
||||||
|
#include "script.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -89,10 +90,6 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||||
if (nNet > 0)
|
if (nNet > 0)
|
||||||
{
|
{
|
||||||
// Credit
|
// Credit
|
||||||
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
|
|
||||||
{
|
|
||||||
if (wallet->IsMine(txout))
|
|
||||||
{
|
|
||||||
if (CBitcoinAddress(rec->address).IsValid())
|
if (CBitcoinAddress(rec->address).IsValid())
|
||||||
{
|
{
|
||||||
CTxDestination address = CBitcoinAddress(rec->address).Get();
|
CTxDestination address = CBitcoinAddress(rec->address).Get();
|
||||||
|
@ -101,7 +98,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||||
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
|
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
|
||||||
strHTML += "<b>" + tr("To") + ":</b> ";
|
strHTML += "<b>" + tr("To") + ":</b> ";
|
||||||
strHTML += GUIUtil::HtmlEscape(rec->address);
|
strHTML += GUIUtil::HtmlEscape(rec->address);
|
||||||
QString addressOwned = wallet->IsMine(txout) == MINE_SPENDABLE ? tr("own address") : tr("watch-only");
|
QString addressOwned = (::IsMine(*wallet, address) == MINE_SPENDABLE) ? tr("own address") : tr("watch-only");
|
||||||
if (!wallet->mapAddressBook[address].name.empty())
|
if (!wallet->mapAddressBook[address].name.empty())
|
||||||
strHTML += " (" + addressOwned + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + ")";
|
strHTML += " (" + addressOwned + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + ")";
|
||||||
else
|
else
|
||||||
|
@ -109,9 +106,6 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||||
strHTML += "<br>";
|
strHTML += "<br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
|
||||||
CTxDestination address;
|
CTxDestination address;
|
||||||
sub.idx = parts.size(); // sequence number
|
sub.idx = parts.size(); // sequence number
|
||||||
sub.credit = txout.nValue;
|
sub.credit = txout.nValue;
|
||||||
|
sub.involvesWatchAddress = mine == MINE_WATCH_ONLY;
|
||||||
if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address))
|
if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address))
|
||||||
{
|
{
|
||||||
// Received by Bitcoin Address
|
// Received by Bitcoin Address
|
||||||
|
@ -70,7 +71,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
|
||||||
sub.type = TransactionRecord::Generated;
|
sub.type = TransactionRecord::Generated;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub.involvesWatchAddress = mine == MINE_WATCH_ONLY;
|
|
||||||
parts.append(sub);
|
parts.append(sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
|
||||||
|
|
||||||
parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "",
|
parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "",
|
||||||
-(nDebit - nChange), nCredit - nChange));
|
-(nDebit - nChange), nCredit - nChange));
|
||||||
parts.last().involvesWatchAddress = involvesWatchAddress;
|
parts.last().involvesWatchAddress = involvesWatchAddress; // maybe pass to TransactionRecord as constructor argument
|
||||||
}
|
}
|
||||||
else if (fAllFromMe)
|
else if (fAllFromMe)
|
||||||
{
|
{
|
||||||
|
@ -115,6 +115,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
|
||||||
const CTxOut& txout = wtx.vout[nOut];
|
const CTxOut& txout = wtx.vout[nOut];
|
||||||
TransactionRecord sub(hash, nTime);
|
TransactionRecord sub(hash, nTime);
|
||||||
sub.idx = parts.size();
|
sub.idx = parts.size();
|
||||||
|
sub.involvesWatchAddress = involvesWatchAddress;
|
||||||
|
|
||||||
if(wallet->IsMine(txout))
|
if(wallet->IsMine(txout))
|
||||||
{
|
{
|
||||||
|
@ -146,7 +147,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
|
||||||
}
|
}
|
||||||
sub.debit = -nValue;
|
sub.debit = -nValue;
|
||||||
|
|
||||||
sub.involvesWatchAddress = involvesWatchAddress;
|
|
||||||
parts.append(sub);
|
parts.append(sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue