-
Notifications
You must be signed in to change notification settings - Fork 138
fix amounts in overflow bug description #1381
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
Conversation
easy changes: INT64_MAX is 9223372036854775807 (2**63-1) INT64_MIN is -9223372036854775808 (-2**63) for whatever reason, post bitcoinops#1 in bitcointalk topic 822 ( https://bitcointalk.org/index.php?topic=822.0 ) contains a different output amount than post bitcoinops#3 post bitcoinops#1: 92233720368.54277039 (0x7ffffffffff863af) post bitcoinops#3: 92233720368.54275808 (0x7ffffffffff85ee0) I'm assuming post bitcoinops#3 ist right, because it's 2**63-500000, and the sum of outputs is minus 1 million sats (-0.01 BTC). (9223372036854275808*2 - 2**64 = -1000000)
I spent some time looking into this. I found the raw transaction from the value overflow incident:
The two output amounts were Edit: I notice that a second raw transaction is posted later in the thread which does appear to have the value of 9,223,372,036,854,275,808:
I’ll have to look further into this. |
Okay, yeah, you are right. The two outputs sum to –0.01 ₿ which then explains why the coinbase collects 50 ₿ new coins and 0.5 ₿ –(–0.01 ₿) = 50.51 ₿ from the transaction. I will look over the text, I think we might need to amend the text a little further. |
_topics/en/soft-fork-activation.md
Outdated
starting with -9,223,372,036,854,775,808 sats. This meant it looked like the | ||
transaction spent a total of -0.01 BTC (negative 0.01 BTC). This |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
starting with -9,223,372,036,854,775,808 sats. This meant it looked like the | |
transaction spent a total of -0.01 BTC (negative 0.01 BTC). This | |
starting with -9,223,372,036,854,775,808 sats. This meant it looked like the | |
transaction outputs summed to a total of -0.01 BTC (negative 0.01 BTC). This |
Oh, I just realized that thread is from last month. Is that you digging up the actual raw transaction? :) |
Thanks for your response @murchandamus :) Nice investigation by ercewubam in that thread from march. No, that's not me.
Is there still something to amend? :) Edit: we could change the commit message to this:
|
38028a8
to
9db038c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I have rediscovered the minutiae of this situation.
• There were two 92 billion BTC outputs, each individually 500,000 sats below INT64_MAX
• In sum, these two outputs add up to -1,000,000 sats or -0.01 BTC due to an integer overflow when they were summed up
• This resulted in a transaction fee of 0.51 BTC, from the input with 0.5 BTC minus the -0.01 BTC (i.e., -(-0.01) = + 0.01) from the summed outputs
I’ve added half a sentence that would have helped me catch on faster, and otherwise concur with the proposed changes by @MBaum21.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, thank you @MBaum21 and @murchandamus
easy changes:
INT64_MAX
is9223372036854775807
(2**63-1
)INT64_MIN
is-9223372036854775808
(-2**63
)other changes:
For whatever reason, post # 1 in bitcointalk topic 822 contains a different output amount than post # 3
post #1: 92233720368.54277039 (0x7ffffffffff863af)
post #3: 92233720368.54275808 (0x7ffffffffff85ee0)
I'm assuming post # 3 ist right, because it's
2**63-500000
, and the sum of outputs is a round number: -0.01 BTC (minus 1 million sats). (calculation:9223372036854275808*2 - 2**64 = -1000000
)