| 301 | } |
| 302 | |
| 303 | void 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 | |
| 332 | void BlockManager::FindFilesToPrune( |
| 333 | std::set<int>& setFilesToPrune, |
no test coverage detected