Page MenuHomePhabricator

validation: fix CheckBlockIndex for multiple chainstates
ClosedPublic

Authored by PiRK on Oct 17 2022, 15:16.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC783d2807841b: validation: fix CheckBlockIndex for multiple chainstates
Summary

Adjust CheckBlockIndex to account for

  • assumed-valid block indexes lacking transaction data, and
  • setBlockIndexCandidates for the background chainstate not containing certain entries which rely on assumed-valid ancestors.

Add unittest for UpdateTip behavior

This is a backport of core#21526 [8 & 12/12]
https://github.com/bitcoin/bitcoin/pull/21526/commits/8f5710fd0ac5173b577e5d00708485170b321bcc
https://github.com/bitcoin/bitcoin/pull/21526/commits/673a5bd3377929a0a6a62eda8b560e47bc2cca0c

Depends on D12279

Test Plan

ninja all check-all

Diff Detail

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

Event Timeline

PiRK requested review of this revision.Oct 17 2022, 15:16
Fabien requested changes to this revision.Oct 18 2022, 11:08
Fabien added a subscriber: Fabien.

There is no test, and it's not a refactor

This revision now requires changes to proceed.Oct 18 2022, 11:08
src/validation.cpp
5298 ↗(On Diff #35762)

pindex->pprev != nullptr is now duplicated in the nested ifs

PiRK edited the summary of this revision. (Show Details)
PiRK removed a reviewer: Fabien.

squash with D12282 and fix duplicated pindex->pprev != nullptr

Fabien added inline comments.
src/validation.cpp
5396–5414 ↗(On Diff #35826)
This revision is now accepted and ready to land.Oct 19 2022, 10:21