aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Harding <tomh@thinlink.com>2015-06-12 14:07:43 -0700
committerWladimir J. van der Laan <laanwj@gmail.com>2015-06-15 09:03:25 +0200
commitc9fd9078ced17f6880274b4764736c5a9ab4eddb (patch)
tree2eabcd20f04c02b8674c354a15891753ab8dac4a
parent94cd7051a324faad636d0b209863828d8ccbcba5 (diff)
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. Github-Pull: #6276 Rebased-From: 7d6a85ab5b1dc96e0f3f6f835f27bb81ba2af919
-rw-r--r--src/wallet/rpcwallet.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 3f55b04273..7a0e5989e0 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -733,12 +733,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 '*' 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;
@@ -2343,4 +2343,4 @@ Value listunspent(const Array& params, bool fHelp)
}
return results;
-} \ No newline at end of file
+}