Split off from #22564 per Marco’s suggestion: #22564 (comment)
This is basically the move-mostly parts of #22564. The overall intent is to move mutable globals manually reset by ::UnloadBlockIndex
into appropriate structs such that they are cleared at the appropriate times. Please read #22564’s description for more rationale.
In summary , this PR moves:
pindexBestHeader
->ChainstateManager::m_best_header
fHavePruned
->BlockManager::m_have_pruned