Fixed lock during block downloading.

This commit is contained in:
Just Wonder 2020-05-09 10:26:13 -07:00
parent 26c6fb1d17
commit 290612e9db

View File

@ -21,8 +21,9 @@ static void cn_get_block_hash_by_height(uint64_t seed_height, char cnHash[32])
{
CBlockIndex* pblockindex = chainActive[seed_height];
if (pblockindex == NULL) {
AssertLockHeld(cs_main);
// This will only happens during initial block download.
// This will happen during initial block downloading, or when we
// are out of sync by more than at least SEEDHASH_EPOCH_BLOCKS blocks.
LOCK(cs_main);
pblockindex = mapBlockSeedHeight.find(seed_height)->second;
}
if (pblockindex == NULL) {