Page MenuHomePhabricator

Merge #13431: validation: count blocks correctly for check level < 3
ClosedPublic

Authored by nakihito on Sep 17 2019, 23:03.

Details

Summary

f618ebc4e4 validation: count blocks correctly for check level < 3 (Karl-Johan Alm)

Pull request description:

As noted in https://github.com/bitcoin/bitcoin/pull/13428#issuecomment-396129295 there is a bug where if check level < 3, the resulting count for blocks is wrong, because `pindexState` is never updated.

Post-commit `./bitcoin-cli verifychain 1 3`:
```

2018-06-11T07:12:28Z Verifying last 3 blocks at level 1
2018-06-11T07:12:28Z [0%]...[33%]...[66%]...[99%]...[DONE].
2018-06-11T07:12:28Z No coin database inconsistencies in last 3 blocks (0 transactions)
```

Pre-commit `./bitcoin-cli verifychain 1 3`:
```
2018-06-11T07:13:34Z Verifying last 3 blocks at level 1
2018-06-11T07:13:34Z [0%]...[33%]...[66%]...[99%]...[DONE].
2018-06-11T07:13:34Z No coin database inconsistencies in last 0 blocks (0 transactions)
```

Tree-SHA512: 3d82ed26665162c9615fb0e6e91a46ed4d229a5e6797c6c420e6b0bf1be6e5e02401c6e9a93b7a5aec503a2650d8c20d1b45fe300a922379e4cef8ee26e18d96

Backport of Core PR13431
https://github.com/bitcoin/bitcoin/pull/13431/

Depends on D4103

Test Plan
make check
./bitcoind --printtoconsole
./bitcoin-cli verifychain 1 3

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a reviewer: Restricted Owners Package.Sep 17 2019, 23:03

Rebase off D4103 to fix off by one error.

This revision is now accepted and ready to land.Sep 18 2019, 09:12