Browse Source

[wallet] Clarify getbalance help string to explain interaction with bumpfee

Documentation change only, no change in behavior.
0.14
Russell Yanofsky 8 years ago
parent
commit
5a00659b58
  1. 22
      src/wallet/rpcwallet.cpp

22
src/wallet/rpcwallet.cpp

@ -668,7 +668,18 @@ UniValue getbalance(const JSONRPCRequest& request) @@ -668,7 +668,18 @@ UniValue getbalance(const JSONRPCRequest& request)
"Note that the account \"\" is not the same as leaving the parameter out.\n"
"The server total may be different to the balance in the default \"\" account.\n"
"\nArguments:\n"
"1. \"account\" (string, optional) DEPRECATED. The selected account, or \"*\" for entire wallet. It may be the default account using \"\".\n"
"1. \"account\" (string, optional) DEPRECATED. The account string may be given as a\n"
" specific account name to find the balance associated with wallet keys in\n"
" a named account, or as the empty string (\"\") to find the balance\n"
" associated with wallet keys not in any named account, or as \"*\" to find\n"
" the balance associated with all wallet keys regardless of account.\n"
" When this option is specified, it calculates the balance in a different\n"
" way than when it is not specified, and which can count spends twice when\n"
" there are conflicting pending transactions (such as those created by\n"
" the bumpfee command), temporarily resulting in low or even negative\n"
" balances. In general, account balance calculation is not considered\n"
" reliable and has resulted in confusing outcomes, so it is recommended to\n"
" avoid passing this argument.\n"
"2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
"3. include_watchonly (bool, optional, default=false) Also include balance in watch-only addresses (see 'importaddress')\n"
"\nResult:\n"
@ -696,9 +707,12 @@ UniValue getbalance(const JSONRPCRequest& request) @@ -696,9 +707,12 @@ UniValue getbalance(const JSONRPCRequest& request)
filter = filter | ISMINE_WATCH_ONLY;
if (request.params[0].get_str() == "*") {
// Calculate total balance a different way from GetBalance()
// (GetBalance() sums up all unspent TxOuts)
// getbalance and "getbalance * 1 true" should return the same number
// Calculate total balance in a very different way from GetBalance().
// The biggest difference is that GetBalance() sums up all unspent
// TxOuts paying to the wallet, while this sums up both spent and
// unspent TxOuts paying to the wallet, and then subtracts the values of
// TxIns spending from the wallet. This also has fewer restrictions on
// which unconfirmed transactions are considered trusted.
CAmount nBalance = 0;
for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it)
{

Loading…
Cancel
Save