@@ -1978,7 +1978,7 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
1978
1978
// effectively caching the result of part of the verification.
1979
1979
BlockMap::const_iterator it = m_blockman.m_block_index .find (hashAssumeValid);
1980
1980
if (it != m_blockman.m_block_index .end ()) {
1981
- if (it->second -> GetAncestor (pindex->nHeight ) == pindex &&
1981
+ if (it->second . GetAncestor (pindex->nHeight ) == pindex &&
1982
1982
pindexBestHeader->GetAncestor (pindex->nHeight ) == pindex &&
1983
1983
pindexBestHeader->nChainWork >= nMinimumChainWork) {
1984
1984
// This block is a member of the assumed verified chain and an ancestor of the best header.
@@ -3035,8 +3035,8 @@ bool CChainState::InvalidateBlock(BlockValidationState& state, CBlockIndex* pind
3035
3035
3036
3036
{
3037
3037
LOCK (cs_main);
3038
- for (const auto & entry : m_blockman.m_block_index ) {
3039
- CBlockIndex * candidate = entry.second ;
3038
+ for (auto & entry : m_blockman.m_block_index ) {
3039
+ CBlockIndex* candidate = & entry.second ;
3040
3040
// We don't need to put anything in our active chain into the
3041
3041
// multimap, because those candidates will be found and considered
3042
3042
// as we disconnect.
@@ -3135,8 +3135,8 @@ bool CChainState::InvalidateBlock(BlockValidationState& state, CBlockIndex* pind
3135
3135
// to setBlockIndexCandidates.
3136
3136
BlockMap::iterator it = m_blockman.m_block_index .begin ();
3137
3137
while (it != m_blockman.m_block_index .end ()) {
3138
- if (it->second -> IsValid (BLOCK_VALID_TRANSACTIONS) && it->second -> HaveTxsDownloaded () && !setBlockIndexCandidates.value_comp ()(it->second , m_chain.Tip ())) {
3139
- setBlockIndexCandidates.insert (it->second );
3138
+ if (it->second . IsValid (BLOCK_VALID_TRANSACTIONS) && it->second . HaveTxsDownloaded () && !setBlockIndexCandidates.value_comp ()(& it->second , m_chain.Tip ())) {
3139
+ setBlockIndexCandidates.insert (& it->second );
3140
3140
}
3141
3141
it++;
3142
3142
}
@@ -3159,17 +3159,17 @@ void CChainState::ResetBlockFailureFlags(CBlockIndex *pindex) {
3159
3159
// Remove the invalidity flag from this block and all its descendants.
3160
3160
BlockMap::iterator it = m_blockman.m_block_index .begin ();
3161
3161
while (it != m_blockman.m_block_index .end ()) {
3162
- if (!it->second -> IsValid () && it->second -> GetAncestor (nHeight) == pindex) {
3163
- it->second -> nStatus &= ~BLOCK_FAILED_MASK;
3164
- m_blockman.m_dirty_blockindex .insert (it->second );
3165
- if (it->second -> IsValid (BLOCK_VALID_TRANSACTIONS) && it->second -> HaveTxsDownloaded () && setBlockIndexCandidates.value_comp ()(m_chain.Tip (), it->second )) {
3166
- setBlockIndexCandidates.insert (it->second );
3162
+ if (!it->second . IsValid () && it->second . GetAncestor (nHeight) == pindex) {
3163
+ it->second . nStatus &= ~BLOCK_FAILED_MASK;
3164
+ m_blockman.m_dirty_blockindex .insert (& it->second );
3165
+ if (it->second . IsValid (BLOCK_VALID_TRANSACTIONS) && it->second . HaveTxsDownloaded () && setBlockIndexCandidates.value_comp ()(m_chain.Tip (), & it->second )) {
3166
+ setBlockIndexCandidates.insert (& it->second );
3167
3167
}
3168
- if (it->second == m_chainman.m_best_invalid ) {
3168
+ if (& it->second == m_chainman.m_best_invalid ) {
3169
3169
// Reset invalid block marker if it was pointing to one of those.
3170
3170
m_chainman.m_best_invalid = nullptr ;
3171
3171
}
3172
- m_chainman.m_failed_blocks .erase (it->second );
3172
+ m_chainman.m_failed_blocks .erase (& it->second );
3173
3173
}
3174
3174
it++;
3175
3175
}
@@ -3500,7 +3500,7 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
3500
3500
if (hash != chainparams.GetConsensus ().hashGenesisBlock ) {
3501
3501
if (miSelf != m_blockman.m_block_index .end ()) {
3502
3502
// Block header is already known.
3503
- CBlockIndex* pindex = miSelf->second ;
3503
+ CBlockIndex* pindex = &( miSelf->second ) ;
3504
3504
if (ppindex)
3505
3505
*ppindex = pindex;
3506
3506
if (pindex->nStatus & BLOCK_FAILED_MASK) {
@@ -3522,7 +3522,7 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
3522
3522
LogPrint (BCLog::VALIDATION, " %s: %s prev block not found\n " , __func__, hash.ToString ());
3523
3523
return state.Invalid (BlockValidationResult::BLOCK_MISSING_PREV, " prev-blk-not-found" );
3524
3524
}
3525
- pindexPrev = ( *mi).second ;
3525
+ pindexPrev = &(( *mi).second ) ;
3526
3526
if (pindexPrev->nStatus & BLOCK_FAILED_MASK) {
3527
3527
LogPrint (BCLog::VALIDATION, " %s: %s prev block invalid\n " , __func__, hash.ToString ());
3528
3528
return state.Invalid (BlockValidationResult::BLOCK_INVALID_PREV, " bad-prevblk" );
@@ -3988,13 +3988,13 @@ bool CChainState::ReplayBlocks()
3988
3988
if (m_blockman.m_block_index .count (hashHeads[0 ]) == 0 ) {
3989
3989
return error (" ReplayBlocks(): reorganization to unknown block requested" );
3990
3990
}
3991
- pindexNew = m_blockman.m_block_index [hashHeads[0 ]];
3991
+ pindexNew = &( m_blockman.m_block_index [hashHeads[0 ]]) ;
3992
3992
3993
3993
if (!hashHeads[1 ].IsNull ()) { // The old tip is allowed to be 0, indicating it's the first flush.
3994
3994
if (m_blockman.m_block_index .count (hashHeads[1 ]) == 0 ) {
3995
3995
return error (" ReplayBlocks(): reorganization from unknown block requested" );
3996
3996
}
3997
- pindexOld = m_blockman.m_block_index [hashHeads[1 ]];
3997
+ pindexOld = &( m_blockman.m_block_index [hashHeads[1 ]]) ;
3998
3998
pindexFork = LastCommonAncestor (pindexOld, pindexNew);
3999
3999
assert (pindexFork != nullptr );
4000
4000
}
@@ -4261,8 +4261,8 @@ void CChainState::CheckBlockIndex()
4261
4261
4262
4262
// Build forward-pointing map of the entire block tree.
4263
4263
std::multimap<CBlockIndex*,CBlockIndex*> forward;
4264
- for (const std::pair<const uint256, CBlockIndex* >& entry : m_blockman.m_block_index ) {
4265
- forward.insert (std::make_pair (entry.second -> pprev , entry.second ));
4264
+ for (std::pair<const uint256, CBlockIndex>& entry : m_blockman.m_block_index ) {
4265
+ forward.insert (std::make_pair (entry.second . pprev , & entry.second ));
4266
4266
}
4267
4267
4268
4268
assert (forward.size () == m_blockman.m_block_index .size ());
0 commit comments