@@ -2996,7 +2996,7 @@ CBlockIndex* Chainstate::FindMostWorkChain()
2996
2996
CBlockIndex *pindexTest = pindexNew;
2997
2997
bool fInvalidAncestor = false ;
2998
2998
while (pindexTest && !m_chain.Contains (pindexTest)) {
2999
- assert (pindexTest->HaveTxsDownloaded () || pindexTest->nHeight == 0 );
2999
+ assert (pindexTest->HaveNumChainTxs () || pindexTest->nHeight == 0 );
3000
3000
3001
3001
// Pruned nodes may have entries in setBlockIndexCandidates for
3002
3002
// which block files have been deleted. Remove those as candidates
@@ -3351,7 +3351,7 @@ bool Chainstate::PreciousBlock(BlockValidationState& state, CBlockIndex* pindex)
3351
3351
// call preciousblock 2**31-1 times on the same set of tips...
3352
3352
m_chainman.nBlockReverseSequenceId --;
3353
3353
}
3354
- if (pindex->IsValid (BLOCK_VALID_TRANSACTIONS) && pindex->HaveTxsDownloaded ()) {
3354
+ if (pindex->IsValid (BLOCK_VALID_TRANSACTIONS) && pindex->HaveNumChainTxs ()) {
3355
3355
setBlockIndexCandidates.insert (pindex);
3356
3356
PruneBlockIndexCandidates ();
3357
3357
}
@@ -3399,7 +3399,7 @@ bool Chainstate::InvalidateBlock(BlockValidationState& state, CBlockIndex* pinde
3399
3399
if (!m_chain.Contains (candidate) &&
3400
3400
!CBlockIndexWorkComparator ()(candidate, pindex->pprev ) &&
3401
3401
candidate->IsValid (BLOCK_VALID_TRANSACTIONS) &&
3402
- candidate->HaveTxsDownloaded ()) {
3402
+ candidate->HaveNumChainTxs ()) {
3403
3403
candidate_blocks_by_work.insert (std::make_pair (candidate->nChainWork , candidate));
3404
3404
}
3405
3405
}
@@ -3488,7 +3488,7 @@ bool Chainstate::InvalidateBlock(BlockValidationState& state, CBlockIndex* pinde
3488
3488
// Loop back over all block index entries and add any missing entries
3489
3489
// to setBlockIndexCandidates.
3490
3490
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 ())) {
3492
3492
setBlockIndexCandidates.insert (&block_index);
3493
3493
}
3494
3494
}
@@ -3520,7 +3520,7 @@ void Chainstate::ResetBlockFailureFlags(CBlockIndex *pindex) {
3520
3520
if (!block_index.IsValid () && block_index.GetAncestor (nHeight) == pindex) {
3521
3521
block_index.nStatus &= ~BLOCK_FAILED_MASK;
3522
3522
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)) {
3524
3524
setBlockIndexCandidates.insert (&block_index);
3525
3525
}
3526
3526
if (&block_index == m_chainman.m_best_invalid ) {
@@ -3583,7 +3583,7 @@ void ChainstateManager::ReceivedBlockTransactions(const CBlock& block, CBlockInd
3583
3583
pindexNew->RaiseValidity (BLOCK_VALID_TRANSACTIONS);
3584
3584
m_blockman.m_dirty_blockindex .insert (pindexNew);
3585
3585
3586
- if (pindexNew->pprev == nullptr || pindexNew->pprev ->HaveTxsDownloaded ()) {
3586
+ if (pindexNew->pprev == nullptr || pindexNew->pprev ->HaveNumChainTxs ()) {
3587
3587
// If pindexNew is the genesis block or all parents are BLOCK_VALID_TRANSACTIONS.
3588
3588
std::deque<CBlockIndex*> queue;
3589
3589
queue.push_back (pindexNew);
@@ -4566,7 +4566,7 @@ bool ChainstateManager::LoadBlockIndex()
4566
4566
// here.
4567
4567
if (pindex == GetSnapshotBaseBlock () ||
4568
4568
(pindex->IsValid (BLOCK_VALID_TRANSACTIONS) &&
4569
- (pindex->HaveTxsDownloaded () || pindex->pprev == nullptr ))) {
4569
+ (pindex->HaveNumChainTxs () || pindex->pprev == nullptr ))) {
4570
4570
4571
4571
for (Chainstate* chainstate : GetAll ()) {
4572
4572
chainstate->TryAddBlockIndexCandidate (pindex);
@@ -4890,7 +4890,7 @@ void ChainstateManager::CheckBlockIndex()
4890
4890
}
4891
4891
}
4892
4892
}
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)
4894
4894
// VALID_TRANSACTIONS is equivalent to nTx > 0 for all nodes (whether or not pruning has occurred).
4895
4895
// HAVE_DATA is only equivalent to nTx > 0 (or VALID_TRANSACTIONS) if no pruning has occurred.
4896
4896
// Unless these indexes are assumed valid and pending block download on a
@@ -4920,9 +4920,9 @@ void ChainstateManager::CheckBlockIndex()
4920
4920
// actually seen a block's transactions.
4921
4921
assert (((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TRANSACTIONS) == (pindex->nTx > 0 )); // This is pruning-independent.
4922
4922
}
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 ());
4926
4926
assert (pindex->nHeight == nHeight); // nHeight must be consistent.
4927
4927
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.
4928
4928
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