Add missing locks required when accessing:
int32_t nBlockSequenceId GUARDED_BY(cs_nBlockSequenceId) = 1;
int nLastBlockFile GUARDED_BY(cs_LastBlockFile) = 0;
bool fCheckForPruning GUARDED_BY(cs_LastBlockFile) = false;
CuckooCache::cache<uint256, SignatureCacheHasher> scriptExecutionCache GUARDED_BY(cs_main);
BlockMap& mapBlockIndex GUARDED_BY(cs_main);
std::unique_ptr<CCoinsViewDB> pcoinsdbview GUARDED_BY(cs_main);
std::unique_ptr<CCoinsViewCache> pcoinsTip GUARDED_BY(cs_main);
std::unique_ptr<CBlockTreeDB> pblocktree GUARDED_BY(cs_main);
Also, add the locking annotations that follow from the requirements above.