From d28bd8b7ca2d0d9ad5f01e005b49acdd3a9eb917 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Mon, 4 Feb 2013 14:04:26 -0500 Subject: Fix getbalance discrepency Two changes: Use IsConfirmed() instead of IsFinal(), so 'getbalance "*" 0' uses the same 'is this output spendable' criteria as 'getbalance'. Fixes issue #172. And a tiny refactor to CWallet::GetBalance() (redundant call to IsFinal -- IsConfirmed calls IsFinal). getbalance with no arguments and 'getbalance "*" 0' could return different different results, --- src/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wallet.cpp') diff --git a/src/wallet.cpp b/src/wallet.cpp index b8ef2a20b..d3345cd87 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -899,7 +899,7 @@ int64 CWallet::GetBalance() const for (map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx* pcoin = &(*it).second; - if (pcoin->IsFinal() && pcoin->IsConfirmed()) + if (pcoin->IsConfirmed()) nTotal += pcoin->GetAvailableCredit(); } } -- cgit v1.2.3