HomePhabricator

make pindexBestForkTip and pindexBestForkBase private CChainState members

Description

make pindexBestForkTip and pindexBestForkBase private CChainState members

Summary:
These two pointers are only accessed by CChainState member functions, and they point to elements of CChainState::setBlockIndexCandidates. It makes sense to make them CChainState members, and to reset them just before setBlockIndexCandidates is cleared.

Rename them to m_best_fork_tip and m_best_fork_base. See D13048 for an example of a similar renaming.

See D3570 for why we reset these pointers in UnloadBlockIndex in the past: they used to point to elements in mapBlockIndex which used to be deleted in UnloadBlockIndex

The global UnloadBlockIndex function will be deleted in a following backport commit.

Depends on D13090

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, sdulfari

Reviewed By: #bitcoin_abc, sdulfari

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

Details

Provenance
PiRKAuthored on Feb 1 2023, 15:39
PiRKPushed on Feb 3 2023, 07:30
Reviewer
Restricted Project
Differential Revision
D13091: make pindexBestForkTip and pindexBestForkBase private CChainState members
Parents
rABC093c9f219282: refactor: Introduce GetFirstStoredBlock helper function
Branches
Unknown
Tags
Unknown