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.
{
    AssertLockHeld(cs_main);
    if (::ChainActive().Tip() && ::ChainActive().Tip()->GetBlockHash() == pcoinsTip->GetBestBlock()) return true;
    if (pcoinsTip->GetBestBlock().IsNull() && mapBlockIndex.size() == 1) {
        
        
        LogPrintf("%s: Connecting genesis block...\n", __func__);
        CValidationState state;
        if (!ActivateBestChain(state, chainparams)) {
            LogPrintf("%s: failed to activate chain (%s)\n", __func__, FormatStateMessage(state));
            return false;
        }
    }
    
    CBlockIndex* pindex = LookupBlockIndex(pcoinsTip->GetBestBlock());
    if (!pindex) {
        return false;
    }
    ::ChainActive().SetTip(pindex);
    g_chainstate.PruneBlockIndexCandidates();
    LogPrintf("Loaded best chain: hashBestChain=%s height=%d date=%s progress=%f\n",
        ::ChainActive().Tip()->GetBlockHash().ToString(), ::ChainActive().Height(),
        FormatISO8601DateTime(::ChainActive().Tip()->GetBlockTime()),
        GuessVerificationProgress(chainparams.TxData(), ::ChainActive().Tip()));
    return true;
}
CVerifyDB::CVerifyDB()