sum(getaccounts) != getbalance #25

issue gavinandresen openend this issue on January 9, 2011
  1. gavinandresen commented at 11:43 pm on January 9, 2011: contributor

    tcatm has given me a -testnet wallet where sum(account) does not equal total server balance.

    That should be impossible. He did copy the wallet and use it on two different bitcoinds, but it should still be impossible for the accounts balances to get out of sync with the total wallet balance.

  2. mikegogulski commented at 2:49 am on January 10, 2011: none
    Eek!
  3. gavinandresen commented at 2:56 am on January 10, 2011: contributor
    Before I lose them: http://pastebin.com/evGiRVw2 and http://pastebin.com/wxCnw5SF … are listaccounts and gettransactions ‘*’ output. getbalance returns 850.05, sum(accounts) is 853.05… I’ll be debugging this more tomorrow.
  4. mikegogulski commented at 3:07 am on January 10, 2011: none
    txid 22c1af3bc7f21a1ee74fbe63fcc58d0433ce2c574cf042a8f9129f989ebac68d has two entries associated with it, one of which is for BTC 3, and this is the only BTC 3 transaction in what you pastebinned. Maybe a place to look.
  5. gavinandresen commented at 5:15 pm on January 10, 2011: contributor

    Thanks, mike, it looks like that is the source of the bug. There is 3BTC in “change” that is being miscounted, because the ‘change’ address was assigned to an account (using setaccount “”, I assume).

    The good news is that unless you dig out change addresses from block explorer this bug won’t affect you. It still needs fixing, though…

  6. tcatm commented at 5:49 pm on January 10, 2011: none
    I never used setaccount so something else must have caused it.
  7. gavinandresen commented at 2:00 pm on January 13, 2011: contributor
    After looking more at this, I’m puzzled. The 3BTC transaction is definitely weird, but I don’t think that is the cause– the accounts code thinks it is a multi-send-to-self, and it doesn’t affect the account’s total balance (it is +400 in, -400 out).
  8. mikegogulski commented at 2:13 pm on January 13, 2011: none

    Wishing I had the stones for c++ anymore… still, some thoughts:

    • maybe that tx isn’t to blame.
    • does the bitcoin wallet implement a proper semblance of a double-entry ledger? If not, that’s an enhancement request. (the pastebin records sure look like one, but i’m no accountant)
    • is there cause here to create an in-the-field assert which would trigger a client alert and prompt to submit tx data for fault analysis, in the event of such a disagreement?
  9. gavinandresen commented at 10:53 pm on January 13, 2011: contributor

    I asked Satoshi, and he has a very good theory and what happened:

    Wallet clone “A” spends some coins.

    Wallet clone “B” (this is the one I’m debugging) comes online, runs ReacceptWalletTransactions, sees the spend, and marks the previous transaction (where it got the coins) as spent. HOWEVER, it does NOT add the spend transaction to the wallet. That is the bug, it should.

  10. laanwj referenced this in commit d28ed9c98e on Sep 28, 2011
  11. coblee referenced this in commit e05433d00a on Jul 17, 2012
  12. kac- referenced this in commit a5c0f2711a on Jun 10, 2014
  13. rdponticelli referenced this in commit ebfa43b20a on Nov 26, 2014
  14. rubensayshi referenced this in commit 84046d503f on Mar 16, 2015
  15. dexX7 referenced this in commit 35229f0be8 on May 2, 2015
  16. sdaftuar referenced this in commit f29fe8a297 on May 14, 2015
  17. ptschip referenced this in commit dd95ea8c3a on Mar 11, 2016
  18. nining referenced this in commit 5e907e36ae on Jan 3, 2018
  19. KrzysiekJ referenced this in commit 7cd5894690 on Mar 28, 2018
  20. KolbyML referenced this in commit 5168cb2db2 on Aug 1, 2020
  21. KolbyML referenced this in commit 3a967773a9 on Sep 4, 2020
  22. rajarshimaitra referenced this in commit 4dc7b364d5 on Mar 23, 2021
  23. rajarshimaitra referenced this in commit 28082808d7 on Mar 23, 2021
  24. MarcoFalke referenced this in commit bce09da122 on Apr 28, 2021
  25. MarcoFalke referenced this in commit c857148636 on May 15, 2021
  26. satindergrewal referenced this in commit 34be553add on Jun 22, 2021
  27. rajarshimaitra referenced this in commit 776af4f3b6 on Aug 5, 2021
  28. MarcoFalke 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: 2024-11-18 12:12 UTC

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