fix amounts in overflow bug description#1381
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. |
| 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.
| 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.
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.
bitschmidty
left a comment
There was a problem hiding this comment.
ACK, thank you @MBaum21 and @murchandamus
easy changes:
INT64_MAXis9223372036854775807(2**63-1)INT64_MINis-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)