Fix for GetBlockValue() after block 13,440,000 #3842

pull ditto-b wants to merge 2 commits into bitcoin:master from ditto-b:master changing 2 files +7 −2
  1. ditto-b commented at 12:04 AM on March 11, 2014: contributor

    Forces the block reward to zero when right shift in GetBlockValue() is undefined, after 64 reward halvings (block height 13,440,000).

  2. Fix for GetBlockValue() after block 13,440,000
    Forces the block reward to zero when right shift in GetBlockValue() is
    undefined, after 64 reward halvings (block height 13,440,000).
    c5a9d2ca9e
  3. petertodd commented at 6:17 AM on March 11, 2014: contributor

    NACK

    We should make use of the ~250 years we have to study this issue more carefully.

  4. bf0d7998-81ec-48d1-b236-076ed3c77581 commented at 1:38 AM on March 12, 2014: none

    I'm sure the altcoin creators can figure this out of themselves right?

  5. ditto-b commented at 1:43 AM on March 12, 2014: contributor

    UUID guy is giving altcoin devs way too much credit.

  6. laanwj commented at 7:19 AM on March 14, 2014: member

    Code change looks fine to me. Any value of halvings>32 will already bring the subsidy to 0, so regarding it as zero for halvings>=64 is safe.

  7. laanwj commented at 1:57 PM on April 1, 2014: member

    Are we going to merge this, or not? It appears safe to me but as it involves critical part of the consensus code I don't want to make this decision on my own. @sipa @gmaxwell @gavinandresen

  8. petertodd commented at 2:06 PM on April 1, 2014: contributor

    @ditto-b Could you please do up a test script that actually exercises this code? regtest mode has a shortened halving interval and a trivial PoW so creating the blocks and submitting them locally shouldn't be too hard. You can use https://github.com/petertodd/python-bitcoinlib/ if you know python - it has both the CBlock/CTransaction stuff to make the blocks, and easy access to the RPC interface. I'd be happy to help review it for you.

  9. laanwj commented at 2:17 PM on April 1, 2014: member

    We do have a test for the function (subsidy_limit_test) but it only runs until block 7 000 000. Would be trivial to increase, though.

  10. petertodd commented at 7:19 PM on April 1, 2014: contributor

    @laanwj Gah! I was trying to get @ditto-b to write a test harness for me to use to test the upcoming Litecoin soft-fork.

  11. gmaxwell commented at 10:14 PM on April 1, 2014: contributor

    ACK. This is an implementation of BIP42.

    Though we should make the trivial change of improving the test too.

  12. gergomiho commented at 12:47 AM on April 2, 2014: none

    I think this is a great fix. When I first read about Bitcoin I loved the idea that it has finite coins, and this is how it should be in my opinion.

  13. genjix commented at 2:05 AM on April 2, 2014: none

    :S in 250 years we'll be using qubits, flying around the galaxy and mating with space honeys

    i'm glad you have eternal faith in c++

  14. parentmap commented at 5:44 AM on April 2, 2014: none

    Code is moving away from it's comments. Keep the comment about halving with the actual halving math (l 1085 -> 1079)

  15. aceat64 commented at 5:50 PM on April 2, 2014: none

    This is clearly a bug and one serious enough that I believe if we do not fix it in a timely manner it could destroy confidence in the Bitcoin network.

  16. gmaxwell commented at 5:57 PM on April 2, 2014: contributor

    Timely manner? ... Well I'm absolutely confident that it will be fixed sometime in the hundreds of years required before it matters.

  17. aceat64 commented at 6:11 PM on April 2, 2014: none

    The longer we delay, the more likely it is that a miner alive today could live until this bug occurs. This gives them a greater incentive to not implement the fix. This is particularly true for any toddlers or infants in charge of sizeable farms.

  18. gmaxwell commented at 6:17 PM on April 2, 2014: contributor

    It doesn't matter what miners implement, it matters what the rest of bitcoin nodes run. If you mine with rules inconsistent with the network you are simply not mining.

  19. laanwj commented at 6:35 PM on April 2, 2014: member

    @aceat64 So, have you tested this pull? Have you updated the unit test which is the only thing that's holding this back from being merged? Please do something useful instead of distracting people by screaming hurry hurry hurry.

  20. aceat64 commented at 6:40 PM on April 2, 2014: none

    I feel as though the tone of my message has been misunderstood. I attempted to clarify with my mention of toddlers and infants running large mining farms.

  21. gmaxwell commented at 6:54 PM on April 2, 2014: contributor

    Thanks. :)

  22. Edit subsidy_limit_test to account for BIP42
    Because no one wants 4 gold mines being discovered every mibillenium.
    5cfd3a70a6
  23. rebroad commented at 12:50 AM on April 3, 2014: contributor

    I'm not particularly concerned about what happens to bitcoin in 250 years as I don't expect to be around by then. Is this really likely to be the PR disaster that some people are suggesting?!

  24. BitcoinPullTester commented at 1:27 AM on April 3, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/5cfd3a70a67ba707a8f074a1730724a6e86353b8 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  25. gavinandresen referenced this in commit 8556b0298d on Apr 3, 2014
  26. gavinandresen merged this on Apr 3, 2014
  27. gavinandresen closed this on Apr 3, 2014

  28. sidhujag referenced this in commit 247a5f9511 on Dec 13, 2020
  29. 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-19 12:15 UTC

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