This is to track the regression introduced in master, which needs fixing for 0.14. See #9240, #9371, etc.
pindexIter->nDataPos = 0;
            pindexIter->nUndoPos = 0;
            
            pindexIter->nTx = 0;
            pindexIter->nChainTx = 0;
            pindexIter->nSequenceId = 0;
            
            setDirtyBlockIndex.insert(pindexIter);
            
            setBlockIndexCandidates.erase(pindexIter);
            std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> ret = mapBlocksUnlinked.equal_range(pindexIter->pprev);
            while (ret.first != ret.second) {
                if (ret.first->second == pindexIter) {
                    mapBlocksUnlinked.erase(ret.first++);
                } else {
                    ++ret.first;
                }
            }
        } else if (pindexIter->IsValid(BLOCK_VALID_TRANSACTIONS) && pindexIter->nChainTx) {
            setBlockIndexCandidates.insert(pindexIter);
        }
    }
    PruneBlockIndexCandidates();
    CheckBlockIndex(params.GetConsensus());
    if (!FlushStateToDisk(state, FLUSH_STATE_ALWAYS)) {
        return false;
    }
    return true;
}
void UnloadBlockIndex()