init.cpp:1635 prints mapBlockIndex.size() without cs_main. This is technically a race (though it is rather inconsequential). At some point someone should fix this so tsan stops complaining.
{
    LOCK(cs_main);
    
    
    
    
    if (mapBlockIndex.count(chainparams.GenesisBlock().GetHash()))
        return true;
    try {
        CBlock &block = const_cast<CBlock&>(chainparams.GenesisBlock());
        
        unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
        CDiskBlockPos blockPos;
        CValidationState state;
        if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.GetBlockTime()))
            return error("%s: FindBlockPos failed", __func__);
        if (!WriteBlockToDisk(block, blockPos, chainparams.MessageStart()))
            return error("%s: writing genesis block to disk failed", __func__);
        CBlockIndex *pindex = AddToBlockIndex(block);
        if (!ReceivedBlockTransactions(block, state, pindex, blockPos, chainparams.GetConsensus()))
            return error("%s: genesis block not accepted", __func__);
    } catch (const std::runtime_error& e) {
        return error("%s: failed to write genesis block: %s", __func__, e.what());
    }
    return true;
}
bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskBlockPos *dbp)