Skip to content

Commit fe13fa0

Browse files
committed
Make CheckBlockIndex const
1 parent 51d7663 commit fe13fa0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/validation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5257,7 +5257,7 @@ bool ChainstateManager::ShouldCheckBlockIndex() const
52575257
return true;
52585258
}
52595259

5260-
void ChainstateManager::CheckBlockIndex()
5260+
void ChainstateManager::CheckBlockIndex() const
52615261
{
52625262
if (!ShouldCheckBlockIndex()) {
52635263
return;
@@ -5288,7 +5288,7 @@ void ChainstateManager::CheckBlockIndex()
52885288
if (!best_hdr_chain.Contains(&block_index)) {
52895289
// Only genesis, which must be part of the best header chain, can have a nullptr parent.
52905290
assert(block_index.pprev);
5291-
forward.emplace(block_index.pprev, &block_index);
5291+
forward.emplace(block_index.pprev, const_cast<CBlockIndex*>(&block_index));
52925292
}
52935293
}
52945294
assert(forward.size() + best_hdr_chain.Height() + 1 == m_blockman.m_block_index.size());
@@ -5465,7 +5465,7 @@ void ChainstateManager::CheckBlockIndex()
54655465
}
54665466
}
54675467
// Check whether this block is in m_blocks_unlinked.
5468-
std::pair<std::multimap<CBlockIndex*,CBlockIndex*>::iterator,std::multimap<CBlockIndex*,CBlockIndex*>::iterator> rangeUnlinked = m_blockman.m_blocks_unlinked.equal_range(pindex->pprev);
5468+
std::pair<std::multimap<CBlockIndex*,CBlockIndex*>::const_iterator,std::multimap<CBlockIndex*,CBlockIndex*>::const_iterator> rangeUnlinked = m_blockman.m_blocks_unlinked.equal_range(pindex->pprev);
54695469
bool foundInUnlinked = false;
54705470
while (rangeUnlinked.first != rangeUnlinked.second) {
54715471
assert(rangeUnlinked.first->first == pindex->pprev);
@@ -5645,7 +5645,7 @@ std::optional<uint256> ChainstateManager::SnapshotBlockhash() const
56455645
return std::nullopt;
56465646
}
56475647

5648-
std::vector<Chainstate*> ChainstateManager::GetAll()
5648+
std::vector<Chainstate*> ChainstateManager::GetAll() const
56495649
{
56505650
LOCK(::cs_main);
56515651
std::vector<Chainstate*> out;

src/validation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ class ChainstateManager
985985
*
986986
* By default this only executes fully when using the Regtest chain; see: m_options.check_block_index.
987987
*/
988-
void CheckBlockIndex();
988+
void CheckBlockIndex() const;
989989

990990
/**
991991
* Alias for ::cs_main.
@@ -1077,7 +1077,7 @@ class ChainstateManager
10771077
Chainstate& InitializeChainstate(CTxMemPool* mempool) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
10781078

10791079
//! Get all chainstates currently being used.
1080-
std::vector<Chainstate*> GetAll();
1080+
std::vector<Chainstate*> GetAll() const;
10811081

10821082
//! Construct and activate a Chainstate on the basis of UTXO snapshot data.
10831083
//!

0 commit comments

Comments
 (0)