From e8ef3da7133dd9fc411fa8b3cc8b8fc2f9c58a98 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sun, 26 Jun 2011 19:23:24 +0200 Subject: update core to d0d80170a2ca73004e08fb85007fe055cbf4e411 (CWallet class) --- src/qt/transactionrecord.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/qt/transactionrecord.cpp') diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 2f00fa8752..864dffa99e 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -1,5 +1,6 @@ #include "transactionrecord.h" +#include "headers.h" /* Return positive answer if transaction should be shown in list. */ @@ -29,7 +30,7 @@ bool TransactionRecord::showTransaction(const CWalletTx &wtx) /* * Decompose CWallet transaction to model transaction records. */ -QList TransactionRecord::decomposeTransaction(const CWalletTx &wtx) +QList TransactionRecord::decomposeTransaction(const CWallet *wallet, const CWalletTx &wtx) { QList parts; int64 nTime = wtx.nTimeDisplayed = wtx.GetTxTime(); @@ -59,7 +60,7 @@ QList TransactionRecord::decomposeTransaction(const CWalletTx { int64 nUnmatured = 0; BOOST_FOREACH(const CTxOut& txout, wtx.vout) - nUnmatured += txout.GetCredit(); + nUnmatured += wallet->GetCredit(txout); sub.credit = nUnmatured; } } @@ -76,10 +77,10 @@ QList TransactionRecord::decomposeTransaction(const CWalletTx sub.type = TransactionRecord::RecvWithAddress; BOOST_FOREACH(const CTxOut& txout, wtx.vout) { - if (txout.IsMine()) + if(wallet->IsMine(txout)) { std::vector vchPubKey; - if (ExtractPubKey(txout.scriptPubKey, true, vchPubKey)) + if (ExtractPubKey(txout.scriptPubKey, wallet, vchPubKey)) { sub.address = PubKeyToAddress(vchPubKey); } @@ -93,11 +94,11 @@ QList TransactionRecord::decomposeTransaction(const CWalletTx { 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 && fAllToMe) { @@ -120,13 +121,13 @@ QList TransactionRecord::decomposeTransaction(const CWalletTx TransactionRecord sub(hash, nTime); sub.idx = parts.size(); - if (txout.IsMine()) + if(wallet->IsMine(txout)) { // Ignore parts sent to self, as this is usually the change // from a transaction sent back to our own address. continue; } - else if (!mapValue["to"].empty()) + else if(!mapValue["to"].empty()) { // Sent to IP sub.type = TransactionRecord::SendToIP; @@ -160,9 +161,9 @@ QList TransactionRecord::decomposeTransaction(const CWalletTx // bool fAllMine = true; BOOST_FOREACH(const CTxOut& txout, wtx.vout) - fAllMine = fAllMine && txout.IsMine(); + fAllMine = fAllMine && wallet->IsMine(txout); BOOST_FOREACH(const CTxIn& txin, wtx.vin) - fAllMine = fAllMine && txin.IsMine(); + fAllMine = fAllMine && wallet->IsMine(txin); parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet, 0)); } -- cgit v1.2.3