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 10:13:13 +0200
commit0fd846445894e9641d6a908a3e87065ec4d9fef4 (patch)
treed89fabfcb89093e4bc6e3f376d8bd723119732a4
parent09334e04a90fa49b68f9d3b3e3c4d739de144876 (diff)
downloadbitcoin-0fd846445894e9641d6a908a3e87065ec4d9fef4.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. Github-Pull: #6276 Rebased-From: 7d6a85ab5b1dc96e0f3f6f835f27bb81ba2af919 Rebased-By: @trasher-
-rw-r--r--src/rpcwallet.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp
index e43eee1551..ace6746311 100644
--- a/src/rpcwallet.cpp
+++ b/src/rpcwallet.cpp
@@ -665,12 +665,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 (!IsFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 0)
continue;
CAmount allFee;