Skip to content

Commit 348f4a8

Browse files
fanquakePastaPastaPasta
authored andcommitted
Merge 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
1 parent 2996daa commit 348f4a8

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

src/chain.h

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

src/validation.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,8 @@ void CChainState::ConflictingChainFound(CBlockIndex* pindexNew)
14751475

14761476
// Same as InvalidChainFound, above, except not called directly from InvalidateBlock,
14771477
// 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+
{
14791480
statsClient.inc("warnings.InvalidBlockFound", 1.0f);
14801481
if (state.GetResult() != BlockValidationResult::BLOCK_MUTATED) {
14811482
pindex->nStatus |= BLOCK_FAILED_VALID;
@@ -2087,8 +2088,8 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
20872088
// may have let in a block that violates the rule prior to updating the
20882089
// software, and we would NOT be enforcing the rule here. Fully solving
20892090
// 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).
20922093
// Also, currently the rule against blocks more than 2 hours in the future
20932094
// is enforced in ContextualCheckBlockHeader(); we wouldn't want to
20942095
// re-enforce that rule here (at least until we make it impossible for
@@ -5998,20 +5999,16 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
59985999
LOCK(::cs_main);
59996000

60006001
// 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-
//
60086002
CBlockIndex* index = nullptr;
60096003
for (int i = 0; i <= snapshot_chainstate.m_chain.Height(); ++i) {
60106004
index = snapshot_chainstate.m_chain[i];
60116005

6006+
// Fake nTx so that LoadBlockIndex() loads assumed-valid CBlockIndex
6007+
// entries (among other things)
60126008
if (!index->nTx) {
60136009
index->nTx = 1;
60146010
}
6011+
// Fake nChainTx so that GuessVerificationProgress reports accurately
60156012
index->nChainTx = index->pprev ? index->pprev->nChainTx + index->nTx : 1;
60166013
}
60176014

src/validation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ enum class CoinsCacheSizeState
620620
*
621621
* Anything that is contingent on the current tip of the chain is stored here,
622622
* whereas block information and metadata independent of the current tip is
623-
* kept in `BlockMetadataManager`.
623+
* kept in `BlockManager`.
624624
*/
625625
class CChainState
626626
{

0 commit comments

Comments
 (0)