Coder Social home page Coder Social logo

sum(getaccounts) != getbalance about bitcoin HOT 9 CLOSED

bitcoin avatar bitcoin commented on May 17, 2024
sum(getaccounts) != getbalance

from bitcoin.

Comments (9)

mikegogulski avatar mikegogulski commented on May 17, 2024

Eek!

from bitcoin.

gavinandresen avatar gavinandresen commented on May 17, 2024

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.

from bitcoin.

mikegogulski avatar mikegogulski commented on May 17, 2024

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.

from bitcoin.

gavinandresen avatar gavinandresen commented on May 17, 2024

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...

from bitcoin.

tcatm avatar tcatm commented on May 17, 2024

I never used setaccount so something else must have caused it.

from bitcoin.

gavinandresen avatar gavinandresen commented on May 17, 2024

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).

from bitcoin.

mikegogulski avatar mikegogulski commented on May 17, 2024

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?

from bitcoin.

gavinandresen avatar gavinandresen commented on May 17, 2024

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.

from bitcoin.

gavinandresen avatar gavinandresen commented on May 17, 2024

Fixed.
1d23c74
d9574c2

from bitcoin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.