File tree Expand file tree Collapse file tree 4 files changed +8
-7
lines changed
Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ bool BaseIndex::Init()
7575 if (!m_best_block_index) {
7676 // index is not built yet
7777 // make sure we have all block data back to the genesis
78- prune_violation = node:: GetFirstStoredBlock (active_chain.Tip ()) != active_chain.Genesis ();
78+ prune_violation = m_chainstate-> m_blockman . GetFirstStoredBlock (active_chain.Tip ()) != active_chain.Genesis ();
7979 }
8080 // in case the index has a best block set and is not fully synced
8181 // check if we have the required blocks to continue building the index
Original file line number Diff line number Diff line change @@ -390,7 +390,8 @@ bool BlockManager::IsBlockPruned(const CBlockIndex* pblockindex)
390390 return (m_have_pruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0 );
391391}
392392
393- const CBlockIndex* GetFirstStoredBlock (const CBlockIndex* start_block) {
393+ const CBlockIndex* BlockManager::GetFirstStoredBlock (const CBlockIndex* start_block)
394+ {
394395 AssertLockHeld (::cs_main);
395396 assert (start_block);
396397 const CBlockIndex* last_block = start_block;
Original file line number Diff line number Diff line change @@ -178,6 +178,9 @@ class BlockManager
178178 // ! Returns last CBlockIndex* that is a checkpoint
179179 const CBlockIndex* GetLastCheckpoint (const CCheckpointData& data) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
180180
181+ // ! Find the first block that is not pruned
182+ const CBlockIndex* GetFirstStoredBlock (const CBlockIndex* start_block) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
183+
181184 /* * True if any block files have ever been pruned. */
182185 bool m_have_pruned = false ;
183186
@@ -188,9 +191,6 @@ class BlockManager
188191 void UpdatePruneLock (const std::string& name, const PruneLockInfo& lock_info) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
189192};
190193
191- // ! Find the first block that is not pruned
192- const CBlockIndex* GetFirstStoredBlock (const CBlockIndex* start_block) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
193-
194194void CleanupBlockRevFiles ();
195195
196196/* * Open a block file (blk?????.dat) */
Original file line number Diff line number Diff line change @@ -787,7 +787,7 @@ static RPCHelpMan pruneblockchain()
787787
788788 PruneBlockFilesManual (active_chainstate, height);
789789 const CBlockIndex* block = CHECK_NONFATAL (active_chain.Tip ());
790- const CBlockIndex* last_block = node:: GetFirstStoredBlock (block);
790+ const CBlockIndex* last_block{active_chainstate. m_blockman . GetFirstStoredBlock (block)} ;
791791
792792 return static_cast <uint64_t >(last_block->nHeight );
793793},
@@ -1215,7 +1215,7 @@ RPCHelpMan getblockchaininfo()
12151215 obj.pushKV (" size_on_disk" , chainman.m_blockman .CalculateCurrentUsage ());
12161216 obj.pushKV (" pruned" , node::fPruneMode );
12171217 if (node::fPruneMode ) {
1218- obj.pushKV (" pruneheight" , node:: GetFirstStoredBlock (&tip)->nHeight );
1218+ obj.pushKV (" pruneheight" , chainman. m_blockman . GetFirstStoredBlock (&tip)->nHeight );
12191219
12201220 // if 0, execution bypasses the whole if block.
12211221 bool automatic_pruning{args.GetIntArg (" -prune" , 0 ) != 1 };
You can’t perform that action at this time.
0 commit comments