@@ -2996,7 +2996,7 @@ CBlockIndex* Chainstate::FindMostWorkChain()
29962996 CBlockIndex *pindexTest = pindexNew;
29972997 bool fInvalidAncestor = false ;
29982998 while (pindexTest && !m_chain.Contains (pindexTest)) {
2999- assert (pindexTest->HaveTxsDownloaded () || pindexTest->nHeight == 0 );
2999+ assert (pindexTest->HaveNumChainTxs () || pindexTest->nHeight == 0 );
30003000
30013001 // Pruned nodes may have entries in setBlockIndexCandidates for
30023002 // which block files have been deleted. Remove those as candidates
@@ -3351,7 +3351,7 @@ bool Chainstate::PreciousBlock(BlockValidationState& state, CBlockIndex* pindex)
33513351 // call preciousblock 2**31-1 times on the same set of tips...
33523352 m_chainman.nBlockReverseSequenceId --;
33533353 }
3354- if (pindex->IsValid (BLOCK_VALID_TRANSACTIONS) && pindex->HaveTxsDownloaded ()) {
3354+ if (pindex->IsValid (BLOCK_VALID_TRANSACTIONS) && pindex->HaveNumChainTxs ()) {
33553355 setBlockIndexCandidates.insert (pindex);
33563356 PruneBlockIndexCandidates ();
33573357 }
@@ -3399,7 +3399,7 @@ bool Chainstate::InvalidateBlock(BlockValidationState& state, CBlockIndex* pinde
33993399 if (!m_chain.Contains (candidate) &&
34003400 !CBlockIndexWorkComparator ()(candidate, pindex->pprev ) &&
34013401 candidate->IsValid (BLOCK_VALID_TRANSACTIONS) &&
3402- candidate->HaveTxsDownloaded ()) {
3402+ candidate->HaveNumChainTxs ()) {
34033403 candidate_blocks_by_work.insert (std::make_pair (candidate->nChainWork , candidate));
34043404 }
34053405 }
@@ -3488,7 +3488,7 @@ bool Chainstate::InvalidateBlock(BlockValidationState& state, CBlockIndex* pinde
34883488 // Loop back over all block index entries and add any missing entries
34893489 // to setBlockIndexCandidates.
34903490 for (auto & [_, block_index] : m_blockman.m_block_index ) {
3491- if (block_index.IsValid (BLOCK_VALID_TRANSACTIONS) && block_index.HaveTxsDownloaded () && !setBlockIndexCandidates.value_comp ()(&block_index, m_chain.Tip ())) {
3491+ if (block_index.IsValid (BLOCK_VALID_TRANSACTIONS) && block_index.HaveNumChainTxs () && !setBlockIndexCandidates.value_comp ()(&block_index, m_chain.Tip ())) {
34923492 setBlockIndexCandidates.insert (&block_index);
34933493 }
34943494 }
@@ -3520,7 +3520,7 @@ void Chainstate::ResetBlockFailureFlags(CBlockIndex *pindex) {
35203520 if (!block_index.IsValid () && block_index.GetAncestor (nHeight) == pindex) {
35213521 block_index.nStatus &= ~BLOCK_FAILED_MASK;
35223522 m_blockman.m_dirty_blockindex .insert (&block_index);
3523- if (block_index.IsValid (BLOCK_VALID_TRANSACTIONS) && block_index.HaveTxsDownloaded () && setBlockIndexCandidates.value_comp ()(m_chain.Tip (), &block_index)) {
3523+ if (block_index.IsValid (BLOCK_VALID_TRANSACTIONS) && block_index.HaveNumChainTxs () && setBlockIndexCandidates.value_comp ()(m_chain.Tip (), &block_index)) {
35243524 setBlockIndexCandidates.insert (&block_index);
35253525 }
35263526 if (&block_index == m_chainman.m_best_invalid ) {
@@ -3583,7 +3583,7 @@ void ChainstateManager::ReceivedBlockTransactions(const CBlock& block, CBlockInd
35833583 pindexNew->RaiseValidity (BLOCK_VALID_TRANSACTIONS);
35843584 m_blockman.m_dirty_blockindex .insert (pindexNew);
35853585
3586- if (pindexNew->pprev == nullptr || pindexNew->pprev ->HaveTxsDownloaded ()) {
3586+ if (pindexNew->pprev == nullptr || pindexNew->pprev ->HaveNumChainTxs ()) {
35873587 // If pindexNew is the genesis block or all parents are BLOCK_VALID_TRANSACTIONS.
35883588 std::deque<CBlockIndex*> queue;
35893589 queue.push_back (pindexNew);
@@ -4566,7 +4566,7 @@ bool ChainstateManager::LoadBlockIndex()
45664566 // here.
45674567 if (pindex == GetSnapshotBaseBlock () ||
45684568 (pindex->IsValid (BLOCK_VALID_TRANSACTIONS) &&
4569- (pindex->HaveTxsDownloaded () || pindex->pprev == nullptr ))) {
4569+ (pindex->HaveNumChainTxs () || pindex->pprev == nullptr ))) {
45704570
45714571 for (Chainstate* chainstate : GetAll ()) {
45724572 chainstate->TryAddBlockIndexCandidate (pindex);
@@ -4890,7 +4890,7 @@ void ChainstateManager::CheckBlockIndex()
48904890 }
48914891 }
48924892 }
4893- if (!pindex->HaveTxsDownloaded ()) assert (pindex->nSequenceId <= 0 ); // nSequenceId can't be set positive for blocks that aren't linked (negative is used for preciousblock)
4893+ if (!pindex->HaveNumChainTxs ()) assert (pindex->nSequenceId <= 0 ); // nSequenceId can't be set positive for blocks that aren't linked (negative is used for preciousblock)
48944894 // VALID_TRANSACTIONS is equivalent to nTx > 0 for all nodes (whether or not pruning has occurred).
48954895 // HAVE_DATA is only equivalent to nTx > 0 (or VALID_TRANSACTIONS) if no pruning has occurred.
48964896 // Unless these indexes are assumed valid and pending block download on a
@@ -4920,9 +4920,9 @@ void ChainstateManager::CheckBlockIndex()
49204920 // actually seen a block's transactions.
49214921 assert (((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TRANSACTIONS) == (pindex->nTx > 0 )); // This is pruning-independent.
49224922 }
4923- // All parents having had data (at some point) is equivalent to all parents being VALID_TRANSACTIONS, which is equivalent to HaveTxsDownloaded ().
4924- assert ((pindexFirstNeverProcessed == nullptr ) == pindex->HaveTxsDownloaded ());
4925- assert ((pindexFirstNotTransactionsValid == nullptr ) == pindex->HaveTxsDownloaded ());
4923+ // All parents having had data (at some point) is equivalent to all parents being VALID_TRANSACTIONS, which is equivalent to HaveNumChainTxs ().
4924+ assert ((pindexFirstNeverProcessed == nullptr ) == pindex->HaveNumChainTxs ());
4925+ assert ((pindexFirstNotTransactionsValid == nullptr ) == pindex->HaveNumChainTxs ());
49264926 assert (pindex->nHeight == nHeight); // nHeight must be consistent.
49274927 assert (pindex->pprev == nullptr || pindex->nChainWork >= pindex->pprev ->nChainWork ); // For every block except the genesis block, the chainwork must be larger than the parent's.
49284928 assert (nHeight < 2 || (pindex->pskip && (pindex->pskip ->nHeight < nHeight))); // The pskip pointer must point back for all but the first 2 blocks.
0 commit comments