@@ -1401,8 +1401,9 @@ void CChainState::InvalidChainFound(CBlockIndex* pindexNew)
1401
1401
}
1402
1402
1403
1403
// Same as InvalidChainFound, above, except not called directly from InvalidateBlock,
1404
- // which does its own setBlockIndexCandidates manageent.
1405
- void CChainState::InvalidBlockFound (CBlockIndex *pindex, const BlockValidationState &state) {
1404
+ // which does its own setBlockIndexCandidates management.
1405
+ void CChainState::InvalidBlockFound (CBlockIndex* pindex, const BlockValidationState& state)
1406
+ {
1406
1407
if (state.GetResult () != BlockValidationResult::BLOCK_MUTATED) {
1407
1408
pindex->nStatus |= BLOCK_FAILED_VALID;
1408
1409
m_blockman.m_failed_blocks .insert (pindex);
@@ -1819,8 +1820,8 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
1819
1820
// may have let in a block that violates the rule prior to updating the
1820
1821
// software, and we would NOT be enforcing the rule here. Fully solving
1821
1822
// upgrade from one software version to the next after a consensus rule
1822
- // change is potentially tricky and issue-specific (see RewindBlockIndex ()
1823
- // for one general approach that was used for BIP 141 deployment).
1823
+ // change is potentially tricky and issue-specific (see NeedsRedownload ()
1824
+ // for one approach that was used for BIP 141 deployment).
1824
1825
// Also, currently the rule against blocks more than 2 hours in the future
1825
1826
// is enforced in ContextualCheckBlockHeader(); we wouldn't want to
1826
1827
// re-enforce that rule here (at least until we make it impossible for
@@ -5082,24 +5083,20 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
5082
5083
LOCK (::cs_main);
5083
5084
5084
5085
// Fake various pieces of CBlockIndex state:
5085
- //
5086
- // - nChainTx: so that we accurately report IBD-to-tip progress
5087
- // - nTx: so that LoadBlockIndex() loads assumed-valid CBlockIndex entries
5088
- // (among other things)
5089
- // - nStatus & BLOCK_OPT_WITNESS: so that RewindBlockIndex() doesn't zealously
5090
- // unwind the assumed-valid chain.
5091
- //
5092
5086
CBlockIndex* index = nullptr ;
5093
5087
for (int i = 0 ; i <= snapshot_chainstate.m_chain .Height (); ++i) {
5094
5088
index = snapshot_chainstate.m_chain [i];
5095
5089
5090
+ // Fake nTx so that LoadBlockIndex() loads assumed-valid CBlockIndex
5091
+ // entries (among other things)
5096
5092
if (!index ->nTx ) {
5097
5093
index ->nTx = 1 ;
5098
5094
}
5095
+ // Fake nChainTx so that GuessVerificationProgress reports accurately
5099
5096
index ->nChainTx = index ->pprev ? index ->pprev ->nChainTx + index ->nTx : 1 ;
5100
5097
5101
- // We need to fake this flag so that CChainState::RewindBlockIndex ()
5102
- // won't try to rewind the entire assumed-valid chain on startup.
5098
+ // Fake BLOCK_OPT_WITNESS so that CChainState::NeedsRedownload ()
5099
+ // won't ask to rewind the entire assumed-valid chain on startup.
5103
5100
if (index ->pprev && ::IsWitnessEnabled (index ->pprev , ::Params ().GetConsensus ())) {
5104
5101
index ->nStatus |= BLOCK_OPT_WITNESS;
5105
5102
}
0 commit comments