Skip to content

Commit 346e52a

Browse files
committed
Merge bitcoin/bitcoin#22121: doc: Various validation doc fixups
fa4245d doc: Various validation doc fixups (MarcoFalke) Pull request description: ACKs for top commit: michaelfolkson: Re-ACK fa4245d jnewbery: ACK fa4245d Tree-SHA512: fa1086b09941247a4ffcbc1d7d27dc77a17a3ae093a5146dbb703db9ff4ba5d73ea77bd5b7747af79ea8a7dfe2c4c56a7e19ac5aac3417090e9ae127836022ae
2 parents 3ac5209 + fa4245d commit 346e52a

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

src/chain.h

+1-1
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

+10-13
Original file line numberDiff line numberDiff line change
@@ -1401,8 +1401,9 @@ void CChainState::InvalidChainFound(CBlockIndex* pindexNew)
14011401
}
14021402

14031403
// 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+
{
14061407
if (state.GetResult() != BlockValidationResult::BLOCK_MUTATED) {
14071408
pindex->nStatus |= BLOCK_FAILED_VALID;
14081409
m_blockman.m_failed_blocks.insert(pindex);
@@ -1819,8 +1820,8 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
18191820
// may have let in a block that violates the rule prior to updating the
18201821
// software, and we would NOT be enforcing the rule here. Fully solving
18211822
// 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).
18241825
// Also, currently the rule against blocks more than 2 hours in the future
18251826
// is enforced in ContextualCheckBlockHeader(); we wouldn't want to
18261827
// re-enforce that rule here (at least until we make it impossible for
@@ -5082,24 +5083,20 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
50825083
LOCK(::cs_main);
50835084

50845085
// 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-
//
50925086
CBlockIndex* index = nullptr;
50935087
for (int i = 0; i <= snapshot_chainstate.m_chain.Height(); ++i) {
50945088
index = snapshot_chainstate.m_chain[i];
50955089

5090+
// Fake nTx so that LoadBlockIndex() loads assumed-valid CBlockIndex
5091+
// entries (among other things)
50965092
if (!index->nTx) {
50975093
index->nTx = 1;
50985094
}
5095+
// Fake nChainTx so that GuessVerificationProgress reports accurately
50995096
index->nChainTx = index->pprev ? index->pprev->nChainTx + index->nTx : 1;
51005097

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.
51035100
if (index->pprev && ::IsWitnessEnabled(index->pprev, ::Params().GetConsensus())) {
51045101
index->nStatus |= BLOCK_OPT_WITNESS;
51055102
}

src/validation.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ enum class CoinsCacheSizeState
555555
*
556556
* Anything that is contingent on the current tip of the chain is stored here,
557557
* whereas block information and metadata independent of the current tip is
558-
* kept in `BlockMetadataManager`.
558+
* kept in `BlockManager`.
559559
*/
560560
class CChainState
561561
{

0 commit comments

Comments
 (0)