@@ -4252,26 +4252,28 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskB
42524252 blkdat >> block;
42534253 nRewind = blkdat.GetPos ();
42544254
4255- // detect out of order blocks, and store them for later
42564255 uint256 hash = block.GetHash ();
4257- if (hash != chainparams.GetConsensus ().hashGenesisBlock && mapBlockIndex.find (block.hashPrevBlock ) == mapBlockIndex.end ()) {
4258- LogPrint (BCLog::REINDEX, " %s: Out of order block %s, parent %s not known\n " , __func__, hash.ToString (),
4259- block.hashPrevBlock .ToString ());
4260- if (dbp)
4261- mapBlocksUnknownParent.insert (std::make_pair (block.hashPrevBlock , *dbp));
4262- continue ;
4263- }
4264-
4265- // process in case the block isn't known yet
4266- if (mapBlockIndex.count (hash) == 0 || (mapBlockIndex[hash]->nStatus & BLOCK_HAVE_DATA) == 0 ) {
4256+ {
42674257 LOCK (cs_main);
4268- CValidationState state;
4269- if (g_chainstate.AcceptBlock (pblock, state, chainparams, nullptr , true , dbp, nullptr ))
4270- nLoaded++;
4271- if (state.IsError ())
4272- break ;
4273- } else if (hash != chainparams.GetConsensus ().hashGenesisBlock && mapBlockIndex[hash]->nHeight % 1000 == 0 ) {
4274- LogPrint (BCLog::REINDEX, " Block Import: already had block %s at height %d\n " , hash.ToString (), mapBlockIndex[hash]->nHeight );
4258+ // detect out of order blocks, and store them for later
4259+ if (hash != chainparams.GetConsensus ().hashGenesisBlock && mapBlockIndex.find (block.hashPrevBlock ) == mapBlockIndex.end ()) {
4260+ LogPrint (BCLog::REINDEX, " %s: Out of order block %s, parent %s not known\n " , __func__, hash.ToString (),
4261+ block.hashPrevBlock .ToString ());
4262+ if (dbp)
4263+ mapBlocksUnknownParent.insert (std::make_pair (block.hashPrevBlock , *dbp));
4264+ continue ;
4265+ }
4266+
4267+ // process in case the block isn't known yet
4268+ if (mapBlockIndex.count (hash) == 0 || (mapBlockIndex[hash]->nStatus & BLOCK_HAVE_DATA) == 0 ) {
4269+ CValidationState state;
4270+ if (g_chainstate.AcceptBlock (pblock, state, chainparams, nullptr , true , dbp, nullptr ))
4271+ nLoaded++;
4272+ if (state.IsError ())
4273+ break ;
4274+ } else if (hash != chainparams.GetConsensus ().hashGenesisBlock && mapBlockIndex[hash]->nHeight % 1000 == 0 ) {
4275+ LogPrint (BCLog::REINDEX, " Block Import: already had block %s at height %d\n " , hash.ToString (), mapBlockIndex[hash]->nHeight );
4276+ }
42754277 }
42764278
42774279 // Activate the genesis block so normal node progress can continue
0 commit comments