refactor: validation: mark SnapshotBase as const

It does not modify any logical state. This change is required
for future const-correctness commits.
This commit is contained in:
stickies-v 2025-04-23 15:35:02 +01:00
parent f409444d02
commit d05481df64
No known key found for this signature in database
GPG key ID: 5CB1CE6E5E66A757
2 changed files with 3 additions and 3 deletions

View file

@ -1970,7 +1970,7 @@ Chainstate::Chainstate(
m_chainman(chainman),
m_from_snapshot_blockhash(from_snapshot_blockhash) {}
const CBlockIndex* Chainstate::SnapshotBase()
const CBlockIndex* Chainstate::SnapshotBase() const
{
if (!m_from_snapshot_blockhash) return nullptr;
if (!m_cached_snapshot_base) m_cached_snapshot_base = Assert(m_chainman.m_blockman.LookupBlockIndex(*m_from_snapshot_blockhash));

View file

@ -532,7 +532,7 @@ protected:
bool m_disabled GUARDED_BY(::cs_main) {false};
//! Cached result of LookupBlockIndex(*m_from_snapshot_blockhash)
const CBlockIndex* m_cached_snapshot_base GUARDED_BY(::cs_main) {nullptr};
mutable const CBlockIndex* m_cached_snapshot_base GUARDED_BY(::cs_main){nullptr};
public:
//! Reference to a BlockManager instance which itself is shared across all
@ -596,7 +596,7 @@ public:
*
* nullptr if this chainstate was not created from a snapshot.
*/
const CBlockIndex* SnapshotBase() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
const CBlockIndex* SnapshotBase() const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
/**
* The set of all CBlockIndex entries that have as much work as our current