X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Ftransactiondesc.cpp;h=bb2537a4797879e7c8fd3205be393cc7735780c4;hb=e8ef3da7133dd9fc411fa8b3cc8b8fc2f9c58a98;hp=84b617b7c436c39c3b2c7dec4579c3c6ab04a8e3;hpb=d99f5a470c8c4e80223f7a78679db58db78ee979;p=novacoin.git diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index 84b617b..bb2537a 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -70,10 +70,10 @@ static string FormatTxStatus(const CWalletTx& wtx) } } -string TransactionDesc::toHTML(CWalletTx &wtx) +string TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx) { string strHTML; - CRITICAL_BLOCK(cs_mapAddressBook) + CRITICAL_BLOCK(wallet->cs_mapAddressBook) { strHTML.reserve(4000); strHTML += ""; @@ -122,19 +122,19 @@ string TransactionDesc::toHTML(CWalletTx &wtx) // Credit BOOST_FOREACH(const CTxOut& txout, wtx.vout) { - if (txout.IsMine()) + if (wallet->IsMine(txout)) { vector vchPubKey; - if (ExtractPubKey(txout.scriptPubKey, true, vchPubKey)) + if (ExtractPubKey(txout.scriptPubKey, wallet, vchPubKey)) { string strAddress = PubKeyToAddress(vchPubKey); - if (mapAddressBook.count(strAddress)) + if (wallet->mapAddressBook.count(strAddress)) { strHTML += string() + _("From: ") + _("unknown") + "
"; strHTML += _("To: "); strHTML += HtmlEscape(strAddress); - if (!mapAddressBook[strAddress].empty()) - strHTML += _(" (yours, label: ") + mapAddressBook[strAddress] + ")"; + if (!wallet->mapAddressBook[strAddress].empty()) + strHTML += _(" (yours, label: ") + wallet->mapAddressBook[strAddress] + ")"; else strHTML += _(" (yours)"); strHTML += "
"; @@ -156,8 +156,8 @@ string TransactionDesc::toHTML(CWalletTx &wtx) // Online transaction strAddress = wtx.mapValue["to"]; strHTML += _("To: "); - if (mapAddressBook.count(strAddress) && !mapAddressBook[strAddress].empty()) - strHTML += mapAddressBook[strAddress] + " "; + if (wallet->mapAddressBook.count(strAddress) && !wallet->mapAddressBook[strAddress].empty()) + strHTML += wallet->mapAddressBook[strAddress] + " "; strHTML += HtmlEscape(strAddress) + "
"; } @@ -172,7 +172,7 @@ string TransactionDesc::toHTML(CWalletTx &wtx) // int64 nUnmatured = 0; BOOST_FOREACH(const CTxOut& txout, wtx.vout) - nUnmatured += txout.GetCredit(); + nUnmatured += wallet->GetCredit(txout); strHTML += _("Credit: "); if (wtx.IsInMainChain()) strHTML += strprintf(_("(%s matures in %d more blocks)"), FormatMoney(nUnmatured).c_str(), wtx.GetBlocksToMaturity()); @@ -191,11 +191,11 @@ string TransactionDesc::toHTML(CWalletTx &wtx) { bool fAllFromMe = true; BOOST_FOREACH(const CTxIn& txin, wtx.vin) - fAllFromMe = fAllFromMe && txin.IsMine(); + fAllFromMe = fAllFromMe && wallet->IsMine(txin); bool fAllToMe = true; BOOST_FOREACH(const CTxOut& txout, wtx.vout) - fAllToMe = fAllToMe && txout.IsMine(); + fAllToMe = fAllToMe && wallet->IsMine(txout); if (fAllFromMe) { @@ -204,7 +204,7 @@ string TransactionDesc::toHTML(CWalletTx &wtx) // BOOST_FOREACH(const CTxOut& txout, wtx.vout) { - if (txout.IsMine()) + if (wallet->IsMine(txout)) continue; if (wtx.mapValue["to"].empty()) @@ -215,8 +215,8 @@ string TransactionDesc::toHTML(CWalletTx &wtx) { string strAddress = Hash160ToAddress(hash160); strHTML += _("To: "); - if (mapAddressBook.count(strAddress) && !mapAddressBook[strAddress].empty()) - strHTML += mapAddressBook[strAddress] + " "; + if (wallet->mapAddressBook.count(strAddress) && !wallet->mapAddressBook[strAddress].empty()) + strHTML += wallet->mapAddressBook[strAddress] + " "; strHTML += strAddress; strHTML += "
"; } @@ -244,11 +244,11 @@ string TransactionDesc::toHTML(CWalletTx &wtx) // Mixed debit transaction // BOOST_FOREACH(const CTxIn& txin, wtx.vin) - if (txin.IsMine()) - strHTML += _("Debit: ") + FormatMoney(-txin.GetDebit()) + "
"; + if (wallet->IsMine(txin)) + strHTML += _("Debit: ") + FormatMoney(-wallet->GetDebit(txin)) + "
"; BOOST_FOREACH(const CTxOut& txout, wtx.vout) - if (txout.IsMine()) - strHTML += _("Credit: ") + FormatMoney(txout.GetCredit()) + "
"; + if (wallet->IsMine(txout)) + strHTML += _("Credit: ") + FormatMoney(wallet->GetCredit(txout)) + "
"; } } @@ -274,30 +274,30 @@ string TransactionDesc::toHTML(CWalletTx &wtx) { strHTML += "

debug print

"; BOOST_FOREACH(const CTxIn& txin, wtx.vin) - if (txin.IsMine()) - strHTML += "Debit: " + FormatMoney(-txin.GetDebit()) + "
"; + if(wallet->IsMine(txin)) + strHTML += "Debit: " + FormatMoney(-wallet->IsMine(txin)) + "
"; BOOST_FOREACH(const CTxOut& txout, wtx.vout) - if (txout.IsMine()) - strHTML += "Credit: " + FormatMoney(txout.GetCredit()) + "
"; + if(wallet->IsMine(txout)) + strHTML += "Credit: " + FormatMoney(wallet->IsMine(txout)) + "
"; strHTML += "
Transaction:
"; strHTML += HtmlEscape(wtx.ToString(), true); strHTML += "
Inputs:
"; - CRITICAL_BLOCK(cs_mapWallet) + CRITICAL_BLOCK(wallet->cs_mapWallet) { BOOST_FOREACH(const CTxIn& txin, wtx.vin) { COutPoint prevout = txin.prevout; - map::iterator mi = mapWallet.find(prevout.hash); - if (mi != mapWallet.end()) + map::iterator mi = wallet->mapWallet.find(prevout.hash); + if (mi != wallet->mapWallet.end()) { const CWalletTx& prev = (*mi).second; if (prevout.n < prev.vout.size()) { strHTML += HtmlEscape(prev.ToString(), true); strHTML += "    " + FormatTxStatus(prev) + ", "; - strHTML = strHTML + "IsMine=" + (prev.vout[prevout.n].IsMine() ? "true" : "false") + "
"; + strHTML = strHTML + "IsMine=" + (wallet->IsMine(prev.vout[prevout.n]) ? "true" : "false") + "
"; } } }