Skip to content

Commit 9c56576

Browse files
MarcoFalkePiRK
authored andcommitted
Make BlockManager::LoadBlockIndex private
Summary: BlockManager::LoadBlockIndex is only called by BlockManager::LoadBlockIndexDB. Thus, it can be made private. m_best_invalid is no longer accessed by BlockManager::LoadBlockIndex. Thus, the unused friend can be removed. This is a backport of [[bitcoin/bitcoin#24917 | core#24917]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, sdulfari Reviewed By: #bitcoin_abc, sdulfari Differential Revision: https://reviews.bitcoinabc.org/D13070
1 parent 3cb8cd7 commit 9c56576

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/node/blockstorage.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ class BlockManager {
6969
friend ChainstateManager;
7070

7171
private:
72+
/**
73+
* Load the blocktree off disk and into memory. Populate certain metadata
74+
* per index entry (nStatus, nChainWork, nTimeMax, etc.) as well as
75+
* peripheral collections like m_dirty_blockindex.
76+
*/
77+
bool LoadBlockIndex(const Consensus::Params &consensus_params)
78+
EXCLUSIVE_LOCKS_REQUIRED(cs_main);
7279
void FlushBlockFile(bool fFinalize = false, bool finalize_undo = false);
7380
void FlushUndoFile(int block_file, bool finalize = false);
7481
bool FindBlockPos(FlatFilePos &pos, unsigned int nAddSize,
@@ -143,14 +150,6 @@ class BlockManager {
143150
bool WriteBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
144151
bool LoadBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
145152

146-
/**
147-
* Load the blocktree off disk and into memory. Populate certain metadata
148-
* per index entry (nStatus, nChainWork, nTimeMax, etc.) as well as
149-
* peripheral collections like m_dirty_blockindex.
150-
*/
151-
bool LoadBlockIndex(const Consensus::Params &consensus_params)
152-
EXCLUSIVE_LOCKS_REQUIRED(cs_main);
153-
154153
/** Clear all data members. */
155154
void Unload() EXCLUSIVE_LOCKS_REQUIRED(cs_main);
156155

src/validation.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,6 @@ class ChainstateManager {
10931093

10941094
CBlockIndex *m_best_invalid;
10951095
CBlockIndex *m_best_parked;
1096-
friend bool node::BlockManager::LoadBlockIndex(const Consensus::Params &);
10971096

10981097
//! Internal helper for ActivateSnapshot().
10991098
[[nodiscard]] bool

0 commit comments

Comments
 (0)