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()
75
75
if (!m_best_block_index) {
76
76
// index is not built yet
77
77
// 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 ();
79
79
}
80
80
// in case the index has a best block set and is not fully synced
81
81
// 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)
390
390
return (m_have_pruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0 );
391
391
}
392
392
393
- const CBlockIndex* GetFirstStoredBlock (const CBlockIndex* start_block) {
393
+ const CBlockIndex* BlockManager::GetFirstStoredBlock (const CBlockIndex* start_block)
394
+ {
394
395
AssertLockHeld (::cs_main);
395
396
assert (start_block);
396
397
const CBlockIndex* last_block = start_block;
Original file line number Diff line number Diff line change @@ -178,6 +178,9 @@ class BlockManager
178
178
// ! Returns last CBlockIndex* that is a checkpoint
179
179
const CBlockIndex* GetLastCheckpoint (const CCheckpointData& data) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
180
180
181
+ // ! Find the first block that is not pruned
182
+ const CBlockIndex* GetFirstStoredBlock (const CBlockIndex* start_block) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
183
+
181
184
/* * True if any block files have ever been pruned. */
182
185
bool m_have_pruned = false ;
183
186
@@ -188,9 +191,6 @@ class BlockManager
188
191
void UpdatePruneLock (const std::string& name, const PruneLockInfo& lock_info) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
189
192
};
190
193
191
- // ! Find the first block that is not pruned
192
- const CBlockIndex* GetFirstStoredBlock (const CBlockIndex* start_block) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
193
-
194
194
void CleanupBlockRevFiles ();
195
195
196
196
/* * Open a block file (blk?????.dat) */
Original file line number Diff line number Diff line change @@ -787,7 +787,7 @@ static RPCHelpMan pruneblockchain()
787
787
788
788
PruneBlockFilesManual (active_chainstate, height);
789
789
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)} ;
791
791
792
792
return static_cast <uint64_t >(last_block->nHeight );
793
793
},
@@ -1215,7 +1215,7 @@ RPCHelpMan getblockchaininfo()
1215
1215
obj.pushKV (" size_on_disk" , chainman.m_blockman .CalculateCurrentUsage ());
1216
1216
obj.pushKV (" pruned" , node::fPruneMode );
1217
1217
if (node::fPruneMode ) {
1218
- obj.pushKV (" pruneheight" , node:: GetFirstStoredBlock (&tip)->nHeight );
1218
+ obj.pushKV (" pruneheight" , chainman. m_blockman . GetFirstStoredBlock (&tip)->nHeight );
1219
1219
1220
1220
// if 0, execution bypasses the whole if block.
1221
1221
bool automatic_pruning{args.GetIntArg (" -prune" , 0 ) != 1 };
You can’t perform that action at this time.
0 commit comments