From 485899a93c6f5fff62090907efb0ac938992e1fb Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Tue, 15 Sep 2020 14:09:24 -0400 Subject: [PATCH] style: Make FindFilesToPrune{,Manual} match style guide [META] This is a pure style commit. --- src/validation.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index 389faa99a8..85bece4545 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3999,15 +3999,17 @@ void BlockManager::FindFilesToPruneManual(std::set& setFilesToPrune, int nM assert(fPruneMode && nManualPruneHeight > 0); LOCK2(cs_main, cs_LastBlockFile); - if (chain_tip_height < 0) + if (chain_tip_height < 0) { return; + } // last block to prune is the lesser of (user-specified height, MIN_BLOCKS_TO_KEEP from the tip) unsigned int nLastBlockWeCanPrune = std::min((unsigned)nManualPruneHeight, chain_tip_height - MIN_BLOCKS_TO_KEEP); - int count=0; + int count = 0; for (int fileNumber = 0; fileNumber < nLastBlockFile; fileNumber++) { - if (vinfoBlockFile[fileNumber].nSize == 0 || vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune) + if (vinfoBlockFile[fileNumber].nSize == 0 || vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune) { continue; + } PruneOneBlockFile(fileNumber); setFilesToPrune.insert(fileNumber); count++; @@ -4058,7 +4060,7 @@ void BlockManager::FindFilesToPrune(std::set& setFilesToPrune, uint64_t nPr // before the next pruning. uint64_t nBuffer = BLOCKFILE_CHUNK_SIZE + UNDOFILE_CHUNK_SIZE; uint64_t nBytesToPrune; - int count=0; + int count = 0; if (nCurrentUsage + nBuffer >= nPruneTarget) { // On a prune event, the chainstate DB is flushed. @@ -4073,15 +4075,18 @@ void BlockManager::FindFilesToPrune(std::set& setFilesToPrune, uint64_t nPr for (int fileNumber = 0; fileNumber < nLastBlockFile; fileNumber++) { nBytesToPrune = vinfoBlockFile[fileNumber].nSize + vinfoBlockFile[fileNumber].nUndoSize; - if (vinfoBlockFile[fileNumber].nSize == 0) + if (vinfoBlockFile[fileNumber].nSize == 0) { continue; + } - if (nCurrentUsage + nBuffer < nPruneTarget) // are we below our target? + if (nCurrentUsage + nBuffer < nPruneTarget) { // are we below our target? break; + } // don't prune files that could have a block within MIN_BLOCKS_TO_KEEP of the main chain's tip but keep scanning - if (vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune) + if (vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune) { continue; + } PruneOneBlockFile(fileNumber); // Queue up the files for removal