Browse Source

Merge pull request #6276

7d6a85a Fix getbalance * (Tom Harding)
0.13
Wladimir J. van der Laan 10 years ago
parent
commit
f3d4dbb939
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 4
      src/wallet/rpcwallet.cpp

4
src/wallet/rpcwallet.cpp

@ -733,12 +733,12 @@ UniValue getbalance(const UniValue& params, bool fHelp)
if (params[0].get_str() == "*") { if (params[0].get_str() == "*") {
// Calculate total balance a different way from GetBalance() // Calculate total balance a different way from GetBalance()
// (GetBalance() sums up all unspent TxOuts) // (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; CAmount nBalance = 0;
for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
{ {
const CWalletTx& wtx = (*it).second; const CWalletTx& wtx = (*it).second;
if (!wtx.IsTrusted() || wtx.GetBlocksToMaturity() > 0) if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 0)
continue; continue;
CAmount allFee; CAmount allFee;

Loading…
Cancel
Save