nCheckDepth chain height fix #10774

pull romanornr wants to merge 1 commits into bitcoin:master from romanornr:master changing 1 files +2 −4
  1. romanornr commented at 4:29 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 57ffff6e69
  3. romanornr closed this on Jul 8, 2017

  4. DrahtBot locked this on Sep 8, 2021
Contributors

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