Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getbalance/getbalance '*' discrepancy #172

Closed
gavinandresen opened this issue Apr 20, 2011 · 2 comments
Closed

getbalance/getbalance '*' discrepancy #172

gavinandresen opened this issue Apr 20, 2011 · 2 comments
Labels

Comments

@gavinandresen
Copy link
Contributor

getbalance and getbalance '*' can return different amounts for 0-confirmation transactions, because of the way change transactions are counted. The discrepancy resolves as soon as the transaction is accepted into a block.

Details: CWalletTx::IsConfirmed() returns false for at least some 0-confirmation transactions loaded from a wallet, because they are missing vtxPrev (supporting transactions). That causes the issue, because getbalance (and the send methods) only count outputs of confirmed transactions as available, but GetAmounts (used by getbalance '*') assumes that change TxOuts are always available to be spent.

@davout
Copy link

davout commented May 17, 2012

Do you know if there is any applicable workaround ?

I have a case where I imported a lot of private keys into a wallet, and there's starting to be a very significant discrepancy between what getbalance and what getbalance '*' report, I suspect that this issue might be somehow related as the difference increases with time and with transactions that are being sent...

Any help whatever small would be immensely appreciated !

gavinandresen added a commit to gavinandresen/bitcoin-git that referenced this issue Feb 4, 2013
Two changes:

Use IsConfirmed() instead of IsFinal(), so 'getbalance "*" 0' uses the same
'is this output spendable' criteria as 'getbalance'. Fixes issue bitcoin#172.

And a tiny refactor to CWallet::GetBalance() (redundant call to IsFinal -- IsConfirmed
calls IsFinal).
getbalance with no arguments and 'getbalance "*" 0' could return different different results,
sipa pushed a commit to sipa/bitcoin that referenced this issue Mar 1, 2013
Two changes:

Use IsConfirmed() instead of IsFinal(), so 'getbalance "*" 0' uses the same
'is this output spendable' criteria as 'getbalance'. Fixes issue bitcoin#172.

And a tiny refactor to CWallet::GetBalance() (redundant call to IsFinal -- IsConfirmed
calls IsFinal).
getbalance with no arguments and 'getbalance "*" 0' could return different different results,
@laanwj
Copy link
Member

laanwj commented Nov 12, 2013

Was fixed by #2272 a long time ago, closing

@laanwj laanwj closed this as completed Nov 12, 2013
laudney referenced this issue in reddcoin-project/reddcoin-3.10 Mar 19, 2014
Two changes:

Use IsConfirmed() instead of IsFinal(), so 'getbalance "*" 0' uses the same
'is this output spendable' criteria as 'getbalance'. Fixes issue #172.

And a tiny refactor to CWallet::GetBalance() (redundant call to IsFinal -- IsConfirmed
calls IsFinal).
getbalance with no arguments and 'getbalance "*" 0' could return different different results,
deadalnix pushed a commit to deadalnix/bitcoin that referenced this issue Dec 13, 2016
Changed http:// to https:// on some links
destenson pushed a commit to destenson/bitcoin--bitcoin that referenced this issue Nov 18, 2017
7855f5c [Utils] makeseeds script update (Fuzzbawls)
cd239ab [Wallet] Update checkpoints with v2.2 chain (presstab)
82f66ee [Utils] Add ExecStop= to example systemd service (Aaron Miller)
0d5709a [Qt] Sendcoinsdialog: more place for long locales (Mrs-X)
1583fc2 Remove legacy Dash code IsReferenceNode (Jon Spock)
9a05301 Change alert public key to disable it by zeroing out the first few digits (Jon Spock)

Tree-SHA512: d5fae27f6def8e613cfe8126906a25a22dfe7ea1ce2c06a53084242b7312e25364a802c322560106c3757c9761fd93c0dc38e638b21175f21840bea22d59d1f7
lateminer pushed a commit to lateminer/bitcoin that referenced this issue Dec 9, 2017
Show correct version number in debug window info
classesjack pushed a commit to classesjack/bitcoin that referenced this issue Jan 2, 2018
…ejection-tests

Automated tests for PoS blocks to verify that invalid PoS block are correctly rejected when received over the network.
cryptapus added a commit to cryptapus/bitcoin that referenced this issue Aug 23, 2019
auxpow primitives update, auxpow rpc block update
KolbyML pushed a commit to KolbyML/bitcoin that referenced this issue Nov 21, 2020
PHR-20 Changed text highlighted color to system default
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants