Skip to content

Commit bd616bc

Browse files
committed
Merge bitcoin/bitcoin#24917: Make BlockManager::LoadBlockIndex private
fa1970f Make BlockManager::LoadBlockIndex private (MarcoFalke) Pull request description: * After commit fa27f03 `BlockManager::LoadBlockIndex` is only called by `BlockManager::LoadBlockIndexDB`. Thus, it can be made `private`. * After commit c600ee3 `m_best_invalid` is no longer accessed by `BlockManager::LoadBlockIndex`. Thus, the unused `friend` can be removed. ACKs for top commit: mruddy: ACK fa1970f I verified by double checking references, then applying the patch, and running `make check`. LGTM. Tree-SHA512: 9b36b4c59bf7ad01171764ce61b1be9750fc92d105c4fe939b1a6a70027ab6300d5d2a2fc3e82f981e22c3987f2ca84e092d2e1f8463fa320af9f05048580c0a
2 parents 34ae04d + fa1970f commit bd616bc

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
@@ -83,6 +83,13 @@ class BlockManager
8383
friend ChainstateManager;
8484

8585
private:
86+
/**
87+
* Load the blocktree off disk and into memory. Populate certain metadata
88+
* per index entry (nStatus, nChainWork, nTimeMax, etc.) as well as peripheral
89+
* collections like m_dirty_blockindex.
90+
*/
91+
bool LoadBlockIndex(const Consensus::Params& consensus_params)
92+
EXCLUSIVE_LOCKS_REQUIRED(cs_main);
8693
void FlushBlockFile(bool fFinalize = false, bool finalize_undo = false);
8794
void FlushUndoFile(int block_file, bool finalize = false);
8895
bool FindBlockPos(FlatFilePos& pos, unsigned int nAddSize, unsigned int nHeight, CChain& active_chain, uint64_t nTime, bool fKnown);
@@ -147,14 +154,6 @@ class BlockManager
147154
bool WriteBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
148155
bool LoadBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
149156

150-
/**
151-
* Load the blocktree off disk and into memory. Populate certain metadata
152-
* per index entry (nStatus, nChainWork, nTimeMax, etc.) as well as peripheral
153-
* collections like m_dirty_blockindex.
154-
*/
155-
bool LoadBlockIndex(const Consensus::Params& consensus_params)
156-
EXCLUSIVE_LOCKS_REQUIRED(cs_main);
157-
158157
/** Clear all data members. */
159158
void Unload() EXCLUSIVE_LOCKS_REQUIRED(cs_main);
160159

src/validation.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,6 @@ class ChainstateManager
834834
bool m_snapshot_validated{false};
835835

836836
CBlockIndex* m_best_invalid;
837-
friend bool node::BlockManager::LoadBlockIndex(const Consensus::Params&);
838837

839838
//! Internal helper for ActivateSnapshot().
840839
[[nodiscard]] bool PopulateAndValidateSnapshot(

0 commit comments

Comments
 (0)