Reported here: https://github.com/bitcoin/bitcoin/pull/10244#issuecomment-378035305

Travis log here: https://travis-ci.org/bitcoin/bitcoin/jobs/361243719#L2810

Note the JSON exception:

```
test_framework.authproxy.JSONRPCException: The mempool was not loaded yet (-1) 
```

That exception was introduced here: https://github.com/bitcoin/bitcoin/commit/cb1e319fe9e198c9c5cf5236fe9af5a3d748b9e8#diff-a0c8f511d90e83aa9b5857e819ced344R1617

cc @jtimon 
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->HaveTxsDownloaded()) {
            setBlockIndexCandidates.insert(pindexIter);
        }
    }
    if (chainActive.Tip() != nullptr) {
        
        
        PruneBlockIndexCandidates();
        CheckBlockIndex(params.GetConsensus());
    }
    return true;
}
bool RewindBlockIndex(const CChainParams& params) {