@@ -3999,15 +3999,17 @@ void BlockManager::FindFilesToPruneManual(std::set<int>& setFilesToPrune, int nM
3999
3999
assert (fPruneMode && nManualPruneHeight > 0 );
4000
4000
4001
4001
LOCK2 (cs_main, cs_LastBlockFile);
4002
- if (chain_tip_height < 0 )
4002
+ if (chain_tip_height < 0 ) {
4003
4003
return ;
4004
+ }
4004
4005
4005
4006
// last block to prune is the lesser of (user-specified height, MIN_BLOCKS_TO_KEEP from the tip)
4006
4007
unsigned int nLastBlockWeCanPrune = std::min ((unsigned )nManualPruneHeight, chain_tip_height - MIN_BLOCKS_TO_KEEP);
4007
- int count= 0 ;
4008
+ int count = 0 ;
4008
4009
for (int fileNumber = 0 ; fileNumber < nLastBlockFile; fileNumber++) {
4009
- if (vinfoBlockFile[fileNumber].nSize == 0 || vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune)
4010
+ if (vinfoBlockFile[fileNumber].nSize == 0 || vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune) {
4010
4011
continue ;
4012
+ }
4011
4013
PruneOneBlockFile (fileNumber);
4012
4014
setFilesToPrune.insert (fileNumber);
4013
4015
count++;
@@ -4058,7 +4060,7 @@ void BlockManager::FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPr
4058
4060
// before the next pruning.
4059
4061
uint64_t nBuffer = BLOCKFILE_CHUNK_SIZE + UNDOFILE_CHUNK_SIZE;
4060
4062
uint64_t nBytesToPrune;
4061
- int count= 0 ;
4063
+ int count = 0 ;
4062
4064
4063
4065
if (nCurrentUsage + nBuffer >= nPruneTarget) {
4064
4066
// On a prune event, the chainstate DB is flushed.
@@ -4073,15 +4075,18 @@ void BlockManager::FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPr
4073
4075
for (int fileNumber = 0 ; fileNumber < nLastBlockFile; fileNumber++) {
4074
4076
nBytesToPrune = vinfoBlockFile[fileNumber].nSize + vinfoBlockFile[fileNumber].nUndoSize ;
4075
4077
4076
- if (vinfoBlockFile[fileNumber].nSize == 0 )
4078
+ if (vinfoBlockFile[fileNumber].nSize == 0 ) {
4077
4079
continue ;
4080
+ }
4078
4081
4079
- if (nCurrentUsage + nBuffer < nPruneTarget) // are we below our target?
4082
+ if (nCurrentUsage + nBuffer < nPruneTarget) { // are we below our target?
4080
4083
break ;
4084
+ }
4081
4085
4082
4086
// don't prune files that could have a block within MIN_BLOCKS_TO_KEEP of the main chain's tip but keep scanning
4083
- if (vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune)
4087
+ if (vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune) {
4084
4088
continue ;
4089
+ }
4085
4090
4086
4091
PruneOneBlockFile (fileNumber);
4087
4092
// Queue up the files for removal
0 commit comments