aboutsummaryrefslogtreecommitdiff
path: root/src/rpcwallet.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-02-04 14:04:26 -0500
committerGavin Andresen <gavinandresen@gmail.com>2013-02-04 14:04:26 -0500
commitd28bd8b7ca2d0d9ad5f01e005b49acdd3a9eb917 (patch)
tree1aa2096839505192c878fbd83377a9c778f0cbf9 /src/rpcwallet.cpp
parent77052ab0f396507527d9b9063561fea92360c97d (diff)
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,
Diffstat (limited to 'src/rpcwallet.cpp')
-rw-r--r--src/rpcwallet.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp
index 90a68f560a..76de42eef3 100644
--- a/src/rpcwallet.cpp
+++ b/src/rpcwallet.cpp
@@ -519,12 +519,12 @@ Value getbalance(const Array& params, bool fHelp)
if (params[0].get_str() == "*") {
// Calculate total balance a different way from GetBalance()
// (GetBalance() sums up all unspent TxOuts)
- // getbalance and getbalance '*' should always return the same number.
+ // getbalance and getbalance '*' 0 should return the same number
int64 nBalance = 0;
for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
{
const CWalletTx& wtx = (*it).second;
- if (!wtx.IsFinal())
+ if (!wtx.IsConfirmed())
continue;
int64 allFee;