HomePhabricator

Merge #10775: nCheckDepth chain height fix

Description

Merge #10775: nCheckDepth chain height fix

Summary:
d9d1bd3 nCheckDepth chain height fix (romanornr)

Pull request description:

`
  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.

Tree-SHA512: 8ee0ae5f33b399fa74dc16926709694ccfe1fc8a043cba2f5d00884220ac1b9b13f2df4588041f4133be634e5c7b14f4eebe24294028dafe91581a97dbe627f3

Backport of Core PR 10775
https://github.com/bitcoin/bitcoin/pull/10775/files

Test Plan:
ninja check
test_runner.py

Reviewers: deadalnix, Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Subscribers: teamcity, schancel

Differential Revision: https://reviews.bitcoinabc.org/D2691

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Jul 20 2017, 15:33
jasonbcoxCommitted on Mar 15 2019, 16:17
jasonbcoxPushed on Mar 15 2019, 16:17
Reviewer
Restricted Project
Differential Revision
D2691: Merge #10775: nCheckDepth chain height fix
Parents
rABC97a60cd531da: Bump version to 0.19.2
Branches
Unknown
Tags
Unknown

Event Timeline