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.
{
    
    bool needs_init = fReindex;
    if (!fReindex) {
        bool ret = LoadBlockIndexDB(chainparams);
        if (!ret) return false;
        needs_init = mapBlockIndex.empty();
    }
    if (needs_init) {
        
        
        
        
        
        LogPrintf("Initializing databases...\n");
    }
    return true;
}
bool CChainState::LoadGenesisBlock(const CChainParams& chainparams)