From cf882ecd08d63682370e8e928a63ed51b9aa6734 Mon Sep 17 00:00:00 2001 From: MASM fan Date: Fri, 14 Feb 2014 12:39:24 +0400 Subject: [PATCH] Rename IsConfirmed() to IsTrusted() --- src/qt/transactionrecord.cpp | 2 +- src/rpcwallet.cpp | 2 +- src/wallet.cpp | 8 ++++---- src/wallet.h | 6 ++---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 03862ae..8962d18 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -169,7 +169,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) (wtx.IsCoinBase() ? 1 : 0), wtx.nTimeReceived, idx); - status.confirmed = wtx.IsConfirmed(); + status.confirmed = wtx.IsTrusted(); status.depth = wtx.GetDepthInMainChain(); status.cur_num_blocks = nBestHeight; diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index a14c44f..8a1967a 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -564,7 +564,7 @@ Value getbalance(const Array& params, bool fHelp) for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; - if (!wtx.IsConfirmed()) + if (!wtx.IsTrusted()) continue; int64 allGeneratedImmature, allGeneratedMature, allFee; diff --git a/src/wallet.cpp b/src/wallet.cpp index 85262f7..5957afa 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1005,7 +1005,7 @@ int64 CWallet::GetBalance() const for (map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; - if (pcoin->IsConfirmed()) + if (pcoin->IsTrusted()) nTotal += pcoin->GetAvailableCredit(); } } @@ -1021,7 +1021,7 @@ int64 CWallet::GetUnconfirmedBalance() const for (map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; - if (!pcoin->IsFinal() || !pcoin->IsConfirmed()) + if (!pcoin->IsFinal() || !pcoin->IsTrusted()) nTotal += pcoin->GetAvailableCredit(); } } @@ -1057,7 +1057,7 @@ void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed, const if (!pcoin->IsFinal()) continue; - if (fOnlyConfirmed && !pcoin->IsConfirmed()) + if (fOnlyConfirmed && !pcoin->IsTrusted()) continue; if (pcoin->IsCoinBase() && pcoin->GetBlocksToMaturity() > 0) @@ -2182,7 +2182,7 @@ std::map CWallet::GetAddressBalances() { CWalletTx *pcoin = &walletEntry.second; - if (!pcoin->IsFinal() || !pcoin->IsConfirmed()) + if (!pcoin->IsFinal() || !pcoin->IsTrusted()) continue; if ((pcoin->IsCoinBase() || pcoin->IsCoinStake()) && pcoin->GetBlocksToMaturity() > 0) diff --git a/src/wallet.h b/src/wallet.h index f7a05ad..a78dcee 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -642,16 +642,14 @@ public: return (GetDebit() > 0); } - bool IsConfirmed() const + bool IsTrusted() const { // Quick answer in most cases if (!IsFinal()) return false; if (GetDepthInMainChain() >= 1) return true; - if (!IsFromMe()) // using wtx's cached debit - return false; - if (fConfChange) + if (fConfChange || !IsFromMe()) // using wtx's cached debit return false; // If no confirmations but it's from us, we can still -- 1.7.1