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 committed 2025-04-28 15:11:23 +02:00
1 parent f409444d02
commit d05481df64
2 files changed
+3 -3

No files matched your search

+1 -1
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));
+2 -2
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