diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-29 23:11:40 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-29 23:11:40 +0200 |
commit | 19fba3cd24641407308c5c90abcff6a43365b55a (patch) | |
tree | b2afc2606e88649e4cc3f1fec6f040ea2b64fc21 /src/qt/transactiondesc.cpp | |
parent | 3b59297b36f795e7cdaaab74daefa89cee6dd24d (diff) |
Make debug info more interesting (show SHA160 addresses for inputs)
Diffstat (limited to 'src/qt/transactiondesc.cpp')
-rw-r--r-- | src/qt/transactiondesc.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index 625b8e3f5e..9aeee5deba 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 += "<hr><br>debug print<br><br>"; + strHTML += "<hr><br>Debug information<br><br>"; BOOST_FOREACH(const CTxIn& txin, wtx.vin) 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) 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 += 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) { BOOST_FOREACH(const CTxIn& txin, wtx.vin) { 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()) { - strHTML += HtmlEscape(prev.ToString(), true); - strHTML += " " + FormatTxStatus(prev) + ", "; - strHTML = strHTML + "IsMine=" + (wallet->IsMine(prev.vout[prevout.n]) ? "true" : "false") + "<br>"; + strHTML += "<li>"; + 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") + "</li>"; } } } } + strHTML += "</ul>"; } |