message: Fix crash when deleting block indexes
diff: @@ -4224,14 +4224,14 @@ void CleanBlockIndex()
  while(!ShutdownRequested())
  {
  + if(!IsInitialBlockDownload())
  {
  - LOCK(cs_main);
  -
  + // Select block indexes to delete
  std::vector<uint256> indexNeedErase;
  -
  + {
  + LOCK(cs_main);
  const CBlockIndex *pindexCheck = chainActive[chainActive.Height() - nCheckpointSpan -1];
  -
  - if(!IsInitialBlockDownload() && pindexCheck)
  + if(pindexCheck)
  {
  for (BlockMap::iterator it=mapBlockIndex.begin(); it!=mapBlockIndex.end(); it++)
  {
  @@ -4241,7 +4241,15 @@ void CleanBlockIndex()
  indexNeedErase.push_back(pindex->GetBlockHash());
  }
  }
  + }
  + }
  + // Delete selected block indexes
  + if(indexNeedErase.size() > 0)
  + {
  + SyncWithValidationInterfaceQueue();
  +
  + LOCK(cs_main);
  for(uint256 blockHash : indexNeedErase)
  {
  BlockMap::iterator it=mapBlockIndex.find(blockHash);
  