diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp
index 625b8e3f..9aeee5de 100644
--- a/src/qt/transactiondesc.cpp
+++ b/src/qt/transactiondesc.cpp
@@ -271,36 +271,48 @@ string TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
//
if (fDebug)
{
- strHTML += "
debug print
";
+ strHTML += "
Debug information
";
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
if(wallet->IsMine(txin))
- strHTML += "Debit: " + FormatMoney(-wallet->IsMine(txin)) + "
";
+ strHTML += "Debit: " + FormatMoney(-wallet->GetDebit(txin)) + "
";
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
if(wallet->IsMine(txout))
- strHTML += "Credit: " + FormatMoney(wallet->IsMine(txout)) + "
";
+ strHTML += "Credit: " + FormatMoney(wallet->GetCredit(txout)) + "
";
strHTML += "
Transaction:
";
strHTML += HtmlEscape(wtx.ToString(), true);
- strHTML += "
Inputs:
";
+ CTxDB txdb("r"); // To fetch source txouts
+
+ strHTML += "
Inputs:";
+ strHTML += "";
CRITICAL_BLOCK(wallet->cs_mapWallet)
{
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
{
COutPoint prevout = txin.prevout;
- map::iterator mi = wallet->mapWallet.find(prevout.hash);
- if (mi != wallet->mapWallet.end())
+
+ CTransaction prev;
+ if(txdb.ReadDiskTx(prevout.hash, prev))
{
- const CWalletTx& prev = (*mi).second;
if (prevout.n < prev.vout.size())
{
- strHTML += HtmlEscape(prev.ToString(), true);
- strHTML += " " + FormatTxStatus(prev) + ", ";
- strHTML = strHTML + "IsMine=" + (wallet->IsMine(prev.vout[prevout.n]) ? "true" : "false") + "
";
+ strHTML += "- ";
+ const CTxOut &vout = prev.vout[prevout.n];
+ CBitcoinAddress address;
+ if (ExtractAddress(vout.scriptPubKey, 0, address))
+ {
+ if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].empty())
+ strHTML += wallet->mapAddressBook[address] + " ";
+ strHTML += address.ToString();
+ }
+ strHTML = strHTML + " Amount=" + FormatMoney(vout.nValue);
+ strHTML = strHTML + " IsMine=" + (wallet->IsMine(vout) ? "true" : "false") + "
";
}
}
}
}
+ strHTML += "
";
}