mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-27 07:55:39 +01:00
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: 7d6a85ab5b
This commit is contained in:
committed by
Wladimir J. van der Laan
parent
94cd7051a3
commit
c9fd9078ce
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user