aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Harding <tomh@thinlink.com>2015-06-12 14:07:43 -0700
committerTom Harding <tomh@thinlink.com>2015-06-12 15:31:01 -0700
commit7d6a85ab5b1dc96e0f3f6f835f27bb81ba2af919 (patch)
tree96dfa2f8d0dd4d16763b62388db8782d11f22eae /src
parentab0ec6790355473e96176ec3c2c2b1564ddb296d (diff)
downloadbitcoin-7d6a85ab5b1dc96e0f3f6f835f27bb81ba2af919.tar.xz
Fix getbalance *
Chance "getbalance *" not to use IsTrusted. The method and result now match the "getbalance <specific-account>" behavior. In particular, "getbalance * 0" now works. Also fixed a comment -- GetGalance has required 1 confirmation for many years, and the default "getbalance *" behavior matches that.
Diffstat (limited to 'src')
-rw-r--r--src/wallet/rpcwallet.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index d284fcf15c..43fcc632f0 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -733,12 +733,12 @@ UniValue getbalance(const UniValue& 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 '*' 0 should return the same number
+ // getbalance and "getbalance * 1 true" should return the same number
CAmount nBalance = 0;
for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
{
const CWalletTx& wtx = (*it).second;
- if (!wtx.IsTrusted() || wtx.GetBlocksToMaturity() > 0)
+ if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 0)
continue;
CAmount allFee;