getbalance/getbalance '*' discrepancy #172

issue gavinandresen opened this issue on April 20, 2011
  1. gavinandresen commented at 2:58 PM on April 20, 2011: 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.

  2. davout commented at 1:22 PM on May 17, 2012: none

    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 !

  3. gavinandresen referenced this in commit d28bd8b7ca on Feb 4, 2013
  4. sipa referenced this in commit d9aabf3476 on Mar 1, 2013
  5. laanwj commented at 3:34 PM on November 12, 2013: member

    Was fixed by #2272 a long time ago, closing

  6. laanwj closed this on Nov 12, 2013

  7. laudney referenced this in commit d758cb9966 on Mar 19, 2014
  8. deadalnix referenced this in commit 7c9a2b7d12 on Dec 13, 2016
  9. destenson referenced this in commit 78106b7f03 on Nov 18, 2017
  10. lateminer referenced this in commit 5841be4260 on Dec 9, 2017
  11. classesjack referenced this in commit e929ccc0e1 on Jan 2, 2018
  12. cryptapus referenced this in commit 261b1eb4bc on Aug 23, 2019
  13. attilaaf referenced this in commit bf99ad036f on Jan 13, 2020
  14. KolbyML referenced this in commit 5d9f2bbefc on Nov 21, 2020
  15. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me