This adds more tests to CheckBlockIndex:
- HAVE_DATA is true iff nTx > 0
- BLOCK_VALID_TRANSACTIONS is true iff nTx > 0
- BLOCK_VALID_TRANSACTIONS is true for a block and all parents iff
nChainTx > 0
CBlockIndex*pindexFirstInvalid=NULL;// Oldest ancestor of pindex which is invalid.
CBlockIndex*pindexFirstMissing=NULL;// Oldest ancestor of pindex which does not have BLOCK_HAVE_DATA.
CBlockIndex*pindexFirstNotTreeValid=NULL;// Oldest ancestor of pindex which does not have BLOCK_VALID_TREE (regardless of being valid or not).
CBlockIndex*pindexFirstNotTransactionsValid=NULL;// Oldest ancestor of pindex which does not have BLOCK_VALID_TRANSACTIONS (regardless of being valid or not).
CBlockIndex*pindexFirstNotChainValid=NULL;// Oldest ancestor of pindex which does not have BLOCK_VALID_CHAIN (regardless of being valid or not).
CBlockIndex*pindexFirstNotScriptsValid=NULL;// Oldest ancestor of pindex which does not have BLOCK_VALID_SCRIPTS (regardless of being valid or not).
assert(pindex->nHeight==nHeight);// nHeight must be consistent.
assert(pindex->pprev==NULL||pindex->nChainWork>=pindex->pprev->nChainWork);// For every block except the genesis block, the chainwork must be larger than the parent's.
assert(nHeight<2||(pindex->pskip&&(pindex->pskip->nHeight<nHeight)));// The pskip pointer must point back for all but the first 2 blocks.