nCheckDepth chain height fix #10775

pull romanornr wants to merge 1 commits into bitcoin:master from romanornr:master changing 1 files +1 −3
  1. romanornr commented at 4:43 PM on July 8, 2017: contributor
    if (nCheckDepth <= 0)
        nCheckDepth = 1000000000; // suffices until the year 19000
    if (nCheckDepth > chainActive.Height())
        nCheckDepth = chainActive.Height();
    

    These lines confuse me. Correct me if I am wrong, but we can't check any more blocks than we have right? If someone requests <= 0 it get set it into some huge number and then immediately limit it to the chain height in the following statement.

    if (nCheckDepth > chainActive.Height())
        nCheckDepth = chainActive.Height();
    

    when using --checkblocks=Z When Z is 0 or any other negative number, it will check all blocks.

    I think it should be changed to this maybe.

    if (nCheckDepth <= 0 || nCheckDepth > chainActive.Height())
        nCheckDepth = chainActive.Height();
    

    Which gets rid of that huge number which is confusing for any other altcoins that have a different block time.

  2. nCheckDepth chain height fix d9d1bd3267
  3. promag commented at 11:00 PM on July 8, 2017: member

    That code was added in #972 by @sipa.

    utACK d9d1bd3.

  4. sipa commented at 11:02 PM on July 8, 2017: member

    utACK

  5. fanquake added the label Validation on Jul 8, 2017
  6. TheBlueMatt commented at 2:49 AM on July 9, 2017: member

    utACK

  7. btcdrak commented at 4:59 AM on July 9, 2017: contributor

    utACK

  8. laanwj merged this on Jul 20, 2017
  9. laanwj closed this on Jul 20, 2017

  10. laanwj referenced this in commit 7c2400cb8a on Jul 20, 2017
  11. PastaPastaPasta referenced this in commit 0a2d54729e on Aug 6, 2019
  12. PastaPastaPasta referenced this in commit c2f44a11bf on Aug 6, 2019
  13. PastaPastaPasta referenced this in commit 6481c5f4a9 on Aug 6, 2019
  14. PastaPastaPasta referenced this in commit 000c120ada on Aug 7, 2019
  15. PastaPastaPasta referenced this in commit 32e54670fe on Aug 8, 2019
  16. PastaPastaPasta referenced this in commit ed8d9a780f on Aug 12, 2019
  17. barrystyle referenced this in commit 1408fa06fe on Jan 22, 2020
  18. 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-28 03:15 UTC

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