LoadChainTip requires cs_main to be locked. Under some conditions, it may call ActivateBestChain. However, ActivateBestChain requires cs_main NOT to be taken when called.
if (!g_chainstate.RewindBlockIndex(params)) {
        return false;
    }
    if (::ChainActive().Tip() != nullptr) {
        
        
        
        CValidationState state;
        if (!FlushStateToDisk(params, state, FlushStateMode::ALWAYS)) {
            LogPrintf("RewindBlockIndex: unable to flush state to disk (%s)\n", FormatStateMessage(state));
            return false;
        }
    }
    return true;
}
void CChainState::UnloadBlockIndex() {