MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / FindFilesToPruneManual

Method FindFilesToPruneManual

src/node/blockstorage.cpp:303–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303void BlockManager::FindFilesToPruneManual(
304 std::set<int>& setFilesToPrune,
305 int nManualPruneHeight,
306 const Chainstate& chain)
307{
308 assert(IsPruneMode() && nManualPruneHeight > 0);
309
310 LOCK(::cs_main);
311 if (chain.m_chain.Height() < 0) {
312 return;
313 }
314
315 const auto [min_block_to_prune, last_block_can_prune] = chain.GetPruneRange(nManualPruneHeight);
316
317 int count = 0;
318 for (int fileNumber = 0; fileNumber < this->MaxBlockfileNum(); fileNumber++) {
319 const auto& fileinfo = m_blockfile_info[fileNumber];
320 if (fileinfo.nSize == 0 || fileinfo.nHeightLast > (unsigned)last_block_can_prune || fileinfo.nHeightFirst < (unsigned)min_block_to_prune) {
321 continue;
322 }
323
324 PruneOneBlockFile(fileNumber);
325 setFilesToPrune.insert(fileNumber);
326 count++;
327 }
328 LogInfo("[%s] Prune (Manual): prune_height=%d removed %d blk/rev pairs",
329 chain.GetRole(), last_block_can_prune, count);
330}
331
332void BlockManager::FindFilesToPrune(
333 std::set<int>& setFilesToPrune,

Callers 1

FlushStateToDiskMethod · 0.80

Calls 4

HeightMethod · 0.80
GetPruneRangeMethod · 0.80
GetRoleMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected