Skip to content

Commit 5e3a998

Browse files
committed
Merge 346e52a into merged_master (Bitcoin PR bitcoin/bitcoin#22121)
2 parents e4cbbd4 + 346e52a commit 5e3a998

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

src/chain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class CBlockIndex
182182
//!
183183
//! Note: this value is modified to show BLOCK_OPT_WITNESS during UTXO snapshot
184184
//! load to avoid the block index being spuriously rewound.
185-
//! @sa RewindBlockIndex
185+
//! @sa NeedsRedownload
186186
//! @sa ActivateSnapshot
187187
uint32_t nStatus{0};
188188

src/validation.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,8 +1479,9 @@ void CChainState::InvalidChainFound(CBlockIndex* pindexNew)
14791479
}
14801480

14811481
// Same as InvalidChainFound, above, except not called directly from InvalidateBlock,
1482-
// which does its own setBlockIndexCandidates manageent.
1483-
void CChainState::InvalidBlockFound(CBlockIndex *pindex, const BlockValidationState &state) {
1482+
// which does its own setBlockIndexCandidates management.
1483+
void CChainState::InvalidBlockFound(CBlockIndex* pindex, const BlockValidationState& state)
1484+
{
14841485
if (state.GetResult() != BlockValidationResult::BLOCK_MUTATED) {
14851486
pindex->nStatus |= BLOCK_FAILED_VALID;
14861487
m_blockman.m_failed_blocks.insert(pindex);
@@ -1977,8 +1978,8 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
19771978
// may have let in a block that violates the rule prior to updating the
19781979
// software, and we would NOT be enforcing the rule here. Fully solving
19791980
// upgrade from one software version to the next after a consensus rule
1980-
// change is potentially tricky and issue-specific (see RewindBlockIndex()
1981-
// for one general approach that was used for BIP 141 deployment).
1981+
// change is potentially tricky and issue-specific (see NeedsRedownload()
1982+
// for one approach that was used for BIP 141 deployment).
19821983
// Also, currently the rule against blocks more than 2 hours in the future
19831984
// is enforced in ContextualCheckBlockHeader(); we wouldn't want to
19841985
// re-enforce that rule here (at least until we make it impossible for
@@ -5438,24 +5439,20 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
54385439
LOCK(::cs_main);
54395440

54405441
// Fake various pieces of CBlockIndex state:
5441-
//
5442-
// - nChainTx: so that we accurately report IBD-to-tip progress
5443-
// - nTx: so that LoadBlockIndex() loads assumed-valid CBlockIndex entries
5444-
// (among other things)
5445-
// - nStatus & BLOCK_OPT_WITNESS: so that RewindBlockIndex() doesn't zealously
5446-
// unwind the assumed-valid chain.
5447-
//
54485442
CBlockIndex* index = nullptr;
54495443
for (int i = 0; i <= snapshot_chainstate.m_chain.Height(); ++i) {
54505444
index = snapshot_chainstate.m_chain[i];
54515445

5446+
// Fake nTx so that LoadBlockIndex() loads assumed-valid CBlockIndex
5447+
// entries (among other things)
54525448
if (!index->nTx) {
54535449
index->nTx = 1;
54545450
}
5451+
// Fake nChainTx so that GuessVerificationProgress reports accurately
54555452
index->nChainTx = index->pprev ? index->pprev->nChainTx + index->nTx : 1;
54565453

5457-
// We need to fake this flag so that CChainState::RewindBlockIndex()
5458-
// won't try to rewind the entire assumed-valid chain on startup.
5454+
// Fake BLOCK_OPT_WITNESS so that CChainState::NeedsRedownload()
5455+
// won't ask to rewind the entire assumed-valid chain on startup.
54595456
if (index->pprev && ::IsWitnessEnabled(index->pprev, ::Params().GetConsensus())) {
54605457
index->nStatus |= BLOCK_OPT_WITNESS;
54615458
}

src/validation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ enum class CoinsCacheSizeState
557557
*
558558
* Anything that is contingent on the current tip of the chain is stored here,
559559
* whereas block information and metadata independent of the current tip is
560-
* kept in `BlockMetadataManager`.
560+
* kept in `BlockManager`.
561561
*/
562562
class CChainState
563563
{

0 commit comments

Comments
 (0)