Page MenuHomePhabricator

make pindexBestForkTip and pindexBestForkBase private CChainState members
ClosedPublic

Authored by PiRK on Feb 1 2023, 15:55.

Details

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