This is to track the regression introduced in master, which needs fixing for 0.14. See #9240, #9371, etc.
size_t nNodes = 0;
    int nHeight = 0;
    CBlockIndex* pindexFirstInvalid = NULL; 
    CBlockIndex* pindexFirstMissing = NULL; 
    CBlockIndex* pindexFirstNeverProcessed = NULL; 
    CBlockIndex* pindexFirstNotTreeValid = NULL; 
    CBlockIndex* pindexFirstNotTransactionsValid = NULL; 
    CBlockIndex* pindexFirstNotChainValid = NULL; 
    CBlockIndex* pindexFirstNotScriptsValid = NULL; 
    while (pindex != NULL) {
        nNodes++;
        if (pindexFirstInvalid == NULL && pindex->nStatus & BLOCK_FAILED_VALID) pindexFirstInvalid = pindex;
        if (pindexFirstMissing == NULL && !(pindex->nStatus & BLOCK_HAVE_DATA)) pindexFirstMissing = pindex;
        if (pindexFirstNeverProcessed == NULL && pindex->nTx == 0) pindexFirstNeverProcessed = pindex;
        if (pindex->pprev != NULL && pindexFirstNotTreeValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_TREE) pindexFirstNotTreeValid = pindex;
        if (pindex->pprev != NULL && pindexFirstNotTransactionsValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_TRANSACTIONS) pindexFirstNotTransactionsValid = pindex;
        if (pindex->pprev != NULL && pindexFirstNotChainValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_CHAIN) pindexFirstNotChainValid = pindex;
        if (pindex->pprev != NULL && pindexFirstNotScriptsValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_SCRIPTS) pindexFirstNotScriptsValid = pindex;
        
        if (pindex->pprev == NULL) {
            
            assert(pindex->GetBlockHash() == consensusParams.hashGenesisBlock); 
            assert(pindex == chainActive.Genesis()); 
        }
        if (pindex->nChainTx == 0) assert(pindex->nSequenceId <= 0);  
        
        
        if (!fHavePruned) {