Browse Source

Fixed lock during block downloading.

keva-gui
Just Wonder 5 years ago
parent
commit
290612e9db
  1. 5
      src/primitives/block.cpp

5
src/primitives/block.cpp

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

Loading…
Cancel
Save