HomePhabricator

validation: Move FindForkInGlobalIndex to BlockManager

Description

validation: Move FindForkInGlobalIndex to BlockManager

Summary:
[META] This commit should be followed up by removing the comments and assertions meant only to show that the change is correct.

FindForkInGlobalIndex only acts on BlockManager.

Note to reviewers: Since` FindForkInGlobalIndex` is always called with
::ChainActive() as its first parameter, it is possible to move
FindForkInGlobalIndex to CChainState and remove this const CChain&
parameter to instead use m_chain. However, it seems like the original
intention was for FindForkInGlobalIndex to work with _any_ chain, not
just the current active chain. Let me know if this should be changed.

This is a backport of core#20749 [5/17]
https://github.com/bitcoin/bitcoin/pull/20749/commits/b026e318c39f59a06e29f1b25c7f577e01b25ccb

Depends on D11173

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
Carl Dong <contact@carldong.me>Authored on Aug 25 2020, 20:40
PiRKCommitted on Mar 16 2022, 09:12
PiRKPushed on Mar 16 2022, 09:12
Reviewer
Restricted Project
Differential Revision
D11174: validation: Move FindForkInGlobalIndex to BlockManager
Parents
rABC292bd9871868: validation: Move global LookupBlockIndex method to BlockManager
Branches
Unknown
Tags
Unknown