Skip to content

Commit d05481d

Browse files
committed
refactor: validation: mark SnapshotBase as const
It does not modify any logical state. This change is required for future const-correctness commits.
1 parent f409444 commit d05481d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1970,7 +1970,7 @@ Chainstate::Chainstate(
19701970
m_chainman(chainman),
19711971
m_from_snapshot_blockhash(from_snapshot_blockhash) {}
19721972

1973-
const CBlockIndex* Chainstate::SnapshotBase()
1973+
const CBlockIndex* Chainstate::SnapshotBase() const
19741974
{
19751975
if (!m_from_snapshot_blockhash) return nullptr;
19761976
if (!m_cached_snapshot_base) m_cached_snapshot_base = Assert(m_chainman.m_blockman.LookupBlockIndex(*m_from_snapshot_blockhash));

src/validation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ class Chainstate
532532
bool m_disabled GUARDED_BY(::cs_main) {false};
533533

534534
//! Cached result of LookupBlockIndex(*m_from_snapshot_blockhash)
535-
const CBlockIndex* m_cached_snapshot_base GUARDED_BY(::cs_main) {nullptr};
535+
mutable const CBlockIndex* m_cached_snapshot_base GUARDED_BY(::cs_main){nullptr};
536536

537537
public:
538538
//! Reference to a BlockManager instance which itself is shared across all
@@ -596,7 +596,7 @@ class Chainstate
596596
*
597597
* nullptr if this chainstate was not created from a snapshot.
598598
*/
599-
const CBlockIndex* SnapshotBase() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
599+
const CBlockIndex* SnapshotBase() const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
600600

601601
/**
602602
* The set of all CBlockIndex entries that have as much work as our current

0 commit comments

Comments
 (0)