Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactiondesc.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, | ||||
TransactionRecord *rec, int unit) { | TransactionRecord *rec, int unit) { | ||||
QString strHTML; | QString strHTML; | ||||
LOCK2(cs_main, wallet->cs_wallet); | LOCK2(cs_main, wallet->cs_wallet); | ||||
strHTML.reserve(4000); | strHTML.reserve(4000); | ||||
strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>"; | strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>"; | ||||
int64_t nTime = wtx.GetTxTime(); | int64_t nTime = wtx.GetTxTime(); | ||||
CAmount nCredit = wtx.GetCredit(ISMINE_ALL).GetSatoshis(); | Amount nCredit = wtx.GetCredit(ISMINE_ALL); | ||||
CAmount nDebit = wtx.GetDebit(ISMINE_ALL); | Amount nDebit = wtx.GetDebit(ISMINE_ALL); | ||||
CAmount nNet = nCredit - nDebit; | CAmount nNet = (nCredit - nDebit).GetSatoshis(); | ||||
strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx); | strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx); | ||||
int nRequests = wtx.GetRequestCount(); | int nRequests = wtx.GetRequestCount(); | ||||
if (nRequests != -1) { | if (nRequests != -1) { | ||||
if (nRequests == 0) | if (nRequests == 0) | ||||
strHTML += tr(", has not been successfully broadcast yet"); | strHTML += tr(", has not been successfully broadcast yet"); | ||||
else if (nRequests > 0) | else if (nRequests > 0) | ||||
strHTML += tr(", broadcast through %n node(s)", "", nRequests); | strHTML += tr(", broadcast through %n node(s)", "", nRequests); | ||||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | if (wtx.IsCoinBase() && nCredit == 0) { | ||||
strHTML += "<b>" + tr("Credit") + ":</b> " + | strHTML += "<b>" + tr("Credit") + ":</b> " + | ||||
BitcoinUnits::formatHtmlWithUnit( | BitcoinUnits::formatHtmlWithUnit( | ||||
unit, txout.nValue.GetSatoshis()) + | unit, txout.nValue.GetSatoshis()) + | ||||
"<br>"; | "<br>"; | ||||
} | } | ||||
if (fAllToMe) { | if (fAllToMe) { | ||||
// Payment to self | // Payment to self | ||||
CAmount nChange = wtx.GetChange().GetSatoshis(); | Amount nChange = wtx.GetChange(); | ||||
CAmount nValue = nCredit - nChange; | Amount nValue = nCredit - nChange; | ||||
strHTML += "<b>" + tr("Total debit") + ":</b> " + | strHTML += "<b>" + tr("Total debit") + ":</b> " + | ||||
BitcoinUnits::formatHtmlWithUnit(unit, -nValue) + | BitcoinUnits::formatHtmlWithUnit( | ||||
unit, -nValue.GetSatoshis()) + | |||||
"<br>"; | "<br>"; | ||||
strHTML += "<b>" + tr("Total credit") + ":</b> " + | strHTML += "<b>" + tr("Total credit") + ":</b> " + | ||||
BitcoinUnits::formatHtmlWithUnit(unit, nValue) + | BitcoinUnits::formatHtmlWithUnit( | ||||
unit, nValue.GetSatoshis()) + | |||||
"<br>"; | "<br>"; | ||||
} | } | ||||
Amount nTxFee = nDebit - wtx.tx->GetValueOut(); | Amount nTxFee = nDebit - wtx.tx->GetValueOut(); | ||||
if (nTxFee > 0) | if (nTxFee > 0) | ||||
strHTML += "<b>" + tr("Transaction fee") + ":</b> " + | strHTML += "<b>" + tr("Transaction fee") + ":</b> " + | ||||
BitcoinUnits::formatHtmlWithUnit( | BitcoinUnits::formatHtmlWithUnit( | ||||
unit, -nTxFee.GetSatoshis()) + | unit, -nTxFee.GetSatoshis()) + | ||||
"<br>"; | "<br>"; | ||||
} else { | } else { | ||||
// | // | ||||
// Mixed debit transaction | // Mixed debit transaction | ||||
// | // | ||||
for (const CTxIn &txin : wtx.tx->vin) { | for (const CTxIn &txin : wtx.tx->vin) { | ||||
if (wallet->IsMine(txin)) | if (wallet->IsMine(txin)) | ||||
strHTML += "<b>" + tr("Debit") + ":</b> " + | strHTML += | ||||
"<b>" + tr("Debit") + ":</b> " + | |||||
BitcoinUnits::formatHtmlWithUnit( | BitcoinUnits::formatHtmlWithUnit( | ||||
unit, -wallet->GetDebit(txin, ISMINE_ALL)) + | unit, | ||||
-wallet->GetDebit(txin, ISMINE_ALL).GetSatoshis()) + | |||||
"<br>"; | "<br>"; | ||||
} | } | ||||
for (const CTxOut &txout : wtx.tx->vout) { | for (const CTxOut &txout : wtx.tx->vout) { | ||||
if (wallet->IsMine(txout)) | if (wallet->IsMine(txout)) | ||||
strHTML += "<b>" + tr("Credit") + ":</b> " + | strHTML += "<b>" + tr("Credit") + ":</b> " + | ||||
BitcoinUnits::formatHtmlWithUnit( | BitcoinUnits::formatHtmlWithUnit( | ||||
unit, wallet->GetCredit(txout, ISMINE_ALL) | unit, wallet->GetCredit(txout, ISMINE_ALL) | ||||
.GetSatoshis()) + | .GetSatoshis()) + | ||||
"<br>"; | "<br>"; | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, | ||||
// | // | ||||
// Debug view | // Debug view | ||||
// | // | ||||
if (fDebug) { | if (fDebug) { | ||||
strHTML += "<hr><br>" + tr("Debug information") + "<br><br>"; | strHTML += "<hr><br>" + tr("Debug information") + "<br><br>"; | ||||
for (const CTxIn &txin : wtx.tx->vin) { | for (const CTxIn &txin : wtx.tx->vin) { | ||||
if (wallet->IsMine(txin)) | if (wallet->IsMine(txin)) | ||||
strHTML += "<b>" + tr("Debit") + ":</b> " + | strHTML += | ||||
"<b>" + tr("Debit") + ":</b> " + | |||||
BitcoinUnits::formatHtmlWithUnit( | BitcoinUnits::formatHtmlWithUnit( | ||||
unit, -wallet->GetDebit(txin, ISMINE_ALL)) + | unit, | ||||
-wallet->GetDebit(txin, ISMINE_ALL).GetSatoshis()) + | |||||
"<br>"; | "<br>"; | ||||
} | } | ||||
for (const CTxOut &txout : wtx.tx->vout) { | for (const CTxOut &txout : wtx.tx->vout) { | ||||
if (wallet->IsMine(txout)) | if (wallet->IsMine(txout)) | ||||
strHTML += | strHTML += | ||||
"<b>" + tr("Credit") + ":</b> " + | "<b>" + tr("Credit") + ":</b> " + | ||||
BitcoinUnits::formatHtmlWithUnit( | BitcoinUnits::formatHtmlWithUnit( | ||||
unit, | unit, | ||||
wallet->GetCredit(txout, ISMINE_ALL).GetSatoshis()) + | wallet->GetCredit(txout, ISMINE_ALL).GetSatoshis()) + | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |