@@ -4862,16 +4862,6 @@ void ChainstateManager::CheckBlockIndex()
4862
4862
CBlockIndex* pindexFirstAssumeValid = nullptr ; // Oldest ancestor of pindex which has BLOCK_ASSUMED_VALID
4863
4863
while (pindex != nullptr ) {
4864
4864
nNodes++;
4865
- // Make sure nChainTx sum is correctly computed.
4866
- unsigned int prev_chain_tx = pindex->pprev ? pindex->pprev ->nChainTx : 0 ;
4867
- assert ((pindex->nChainTx == pindex->nTx + prev_chain_tx)
4868
- // Transaction may be completely unset - happens if only the header was accepted but the block hasn't been processed.
4869
- || (pindex->nChainTx == 0 && pindex->nTx == 0 )
4870
- // nChainTx may be unset, but nTx set (if a block has been accepted, but one of its predecessors hasn't been processed yet)
4871
- || (pindex->nChainTx == 0 && prev_chain_tx == 0 && pindex->pprev )
4872
- // Transaction counts prior to snapshot are unknown.
4873
- || pindex->IsAssumedValid ());
4874
-
4875
4865
if (pindexFirstAssumeValid == nullptr && pindex->nStatus & BLOCK_ASSUMED_VALID) pindexFirstAssumeValid = pindex;
4876
4866
if (pindexFirstInvalid == nullptr && pindex->nStatus & BLOCK_FAILED_VALID) pindexFirstInvalid = pindex;
4877
4867
if (pindexFirstMissing == nullptr && !(pindex->nStatus & BLOCK_HAVE_DATA)) {
@@ -4954,6 +4944,15 @@ void ChainstateManager::CheckBlockIndex()
4954
4944
// Checks for not-invalid blocks.
4955
4945
assert ((pindex->nStatus & BLOCK_FAILED_MASK) == 0 ); // The failed mask cannot be set for blocks without invalid parents.
4956
4946
}
4947
+ // Make sure nChainTx sum is correctly computed.
4948
+ unsigned int prev_chain_tx = pindex->pprev ? pindex->pprev ->nChainTx : 0 ;
4949
+ assert ((pindex->nChainTx == pindex->nTx + prev_chain_tx)
4950
+ // Transaction may be completely unset - happens if only the header was accepted but the block hasn't been processed.
4951
+ || (pindex->nChainTx == 0 && pindex->nTx == 0 )
4952
+ // nChainTx may be unset, but nTx set (if a block has been accepted, but one of its predecessors hasn't been processed yet)
4953
+ || (pindex->nChainTx == 0 && prev_chain_tx == 0 && pindex->pprev )
4954
+ // Transaction counts prior to snapshot are unknown.
4955
+ || pindex->IsAssumedValid ());
4957
4956
// Chainstate-specific checks on setBlockIndexCandidates
4958
4957
for (auto c : GetAll ()) {
4959
4958
if (c->m_chain .Tip () == nullptr ) continue ;
0 commit comments