Make debug info more interesting (show SHA160 addresses for inputs)
This commit is contained in:
parent
3b59297b36
commit
19fba3cd24
@ -271,36 +271,48 @@ string TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
|
|||||||
//
|
//
|
||||||
if (fDebug)
|
if (fDebug)
|
||||||
{
|
{
|
||||||
strHTML += "<hr><br>debug print<br><br>";
|
strHTML += "<hr><br>Debug information<br><br>";
|
||||||
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
|
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
|
||||||
if(wallet->IsMine(txin))
|
if(wallet->IsMine(txin))
|
||||||
strHTML += "<b>Debit:</b> " + FormatMoney(-wallet->IsMine(txin)) + "<br>";
|
strHTML += "<b>Debit:</b> " + FormatMoney(-wallet->GetDebit(txin)) + "<br>";
|
||||||
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
|
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
|
||||||
if(wallet->IsMine(txout))
|
if(wallet->IsMine(txout))
|
||||||
strHTML += "<b>Credit:</b> " + FormatMoney(wallet->IsMine(txout)) + "<br>";
|
strHTML += "<b>Credit:</b> " + FormatMoney(wallet->GetCredit(txout)) + "<br>";
|
||||||
|
|
||||||
strHTML += "<br><b>Transaction:</b><br>";
|
strHTML += "<br><b>Transaction:</b><br>";
|
||||||
strHTML += HtmlEscape(wtx.ToString(), true);
|
strHTML += HtmlEscape(wtx.ToString(), true);
|
||||||
|
|
||||||
strHTML += "<br><b>Inputs:</b><br>";
|
CTxDB txdb("r"); // To fetch source txouts
|
||||||
|
|
||||||
|
strHTML += "<br><b>Inputs:</b>";
|
||||||
|
strHTML += "<ul>";
|
||||||
CRITICAL_BLOCK(wallet->cs_mapWallet)
|
CRITICAL_BLOCK(wallet->cs_mapWallet)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
|
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
|
||||||
{
|
{
|
||||||
COutPoint prevout = txin.prevout;
|
COutPoint prevout = txin.prevout;
|
||||||
map<uint256, CWalletTx>::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())
|
if (prevout.n < prev.vout.size())
|
||||||
{
|
{
|
||||||
strHTML += HtmlEscape(prev.ToString(), true);
|
strHTML += "<li>";
|
||||||
strHTML += " " + FormatTxStatus(prev) + ", ";
|
const CTxOut &vout = prev.vout[prevout.n];
|
||||||
strHTML = strHTML + "IsMine=" + (wallet->IsMine(prev.vout[prevout.n]) ? "true" : "false") + "<br>";
|
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") + "</li>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
strHTML += "</ul>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user