@@ -1475,7 +1475,8 @@ void CChainState::ConflictingChainFound(CBlockIndex* pindexNew)
1475
1475
1476
1476
// Same as InvalidChainFound, above, except not called directly from InvalidateBlock,
1477
1477
// which does its own setBlockIndexCandidates manageent.
1478
- void CChainState::InvalidBlockFound (CBlockIndex *pindex, const BlockValidationState &state) {
1478
+ void CChainState::InvalidBlockFound (CBlockIndex *pindex, const BlockValidationState &state)
1479
+ {
1479
1480
statsClient.inc (" warnings.InvalidBlockFound" , 1 .0f );
1480
1481
if (state.GetResult () != BlockValidationResult::BLOCK_MUTATED) {
1481
1482
pindex->nStatus |= BLOCK_FAILED_VALID;
@@ -2087,8 +2088,8 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
2087
2088
// may have let in a block that violates the rule prior to updating the
2088
2089
// software, and we would NOT be enforcing the rule here. Fully solving
2089
2090
// upgrade from one software version to the next after a consensus rule
2090
- // change is potentially tricky and issue-specific (see RewindBlockIndex ()
2091
- // for one general approach that was used for BIP 141 deployment).
2091
+ // change is potentially tricky and issue-specific (see NeedsRedownload ()
2092
+ // for one approach that was used for BIP 141 deployment).
2092
2093
// Also, currently the rule against blocks more than 2 hours in the future
2093
2094
// is enforced in ContextualCheckBlockHeader(); we wouldn't want to
2094
2095
// re-enforce that rule here (at least until we make it impossible for
@@ -5998,20 +5999,16 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
5998
5999
LOCK (::cs_main);
5999
6000
6000
6001
// Fake various pieces of CBlockIndex state:
6001
- //
6002
- // - nChainTx: so that we accurately report IBD-to-tip progress
6003
- // - nTx: so that LoadBlockIndex() loads assumed-valid CBlockIndex entries
6004
- // (among other things)
6005
- // - nStatus & BLOCK_OPT_WITNESS: so that RewindBlockIndex() doesn't zealously
6006
- // unwind the assumed-valid chain.
6007
- //
6008
6002
CBlockIndex* index = nullptr ;
6009
6003
for (int i = 0 ; i <= snapshot_chainstate.m_chain .Height (); ++i) {
6010
6004
index = snapshot_chainstate.m_chain [i];
6011
6005
6006
+ // Fake nTx so that LoadBlockIndex() loads assumed-valid CBlockIndex
6007
+ // entries (among other things)
6012
6008
if (!index->nTx ) {
6013
6009
index->nTx = 1 ;
6014
6010
}
6011
+ // Fake nChainTx so that GuessVerificationProgress reports accurately
6015
6012
index->nChainTx = index->pprev ? index->pprev ->nChainTx + index->nTx : 1 ;
6016
6013
}
6017
6014
0 commit comments