| 114 | } |
| 115 | |
| 116 | void BlockManager::FindFilesToPruneManual(std::set<int>& setFilesToPrune, int nManualPruneHeight, int chain_tip_height) |
| 117 | { |
| 118 | assert(fPruneMode && nManualPruneHeight > 0); |
| 119 | |
| 120 | LOCK2(cs_main, cs_LastBlockFile); |
| 121 | if (chain_tip_height < 0) { |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | // last block to prune is the lesser of (user-specified height, MIN_BLOCKS_TO_KEEP from the tip) |
| 126 | unsigned int nLastBlockWeCanPrune = std::min((unsigned)nManualPruneHeight, chain_tip_height - MIN_BLOCKS_TO_KEEP); |
| 127 | int count = 0; |
| 128 | for (int fileNumber = 0; fileNumber < m_last_blockfile; fileNumber++) { |
| 129 | if (m_blockfile_info[fileNumber].nSize == 0 || m_blockfile_info[fileNumber].nHeightLast > nLastBlockWeCanPrune) { |
| 130 | continue; |
| 131 | } |
| 132 | PruneOneBlockFile(fileNumber); |
| 133 | setFilesToPrune.insert(fileNumber); |
| 134 | count++; |
| 135 | } |
| 136 | LogPrintf("Prune (Manual): prune_height=%d removed %d blk/rev pairs\n", nLastBlockWeCanPrune, count); |
| 137 | } |
| 138 | |
| 139 | void BlockManager::FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfterHeight, int chain_tip_height, int prune_height, bool is_ibd) |
| 140 | { |
no test coverage detected