src/validation.cpp
void FindFilesToPruneManual(std::set<int>& setFilesToPrune, int nManualPruneHeight)
{
    assert(fPruneMode && nManualPruneHeight > 0);

    LOCK2(cs_main, cs_LastBlockFile);
    if (chainActive.Tip() == nullptr)
        return;

    // last block to prune is the lesser of (user-specified height, MIN_BLOCKS_TO_KEEP from the tip)
    unsigned int nLastBlockWeCanPrune = std::min(nManualPruneHeight, chainActive.Tip()->nHeight - MIN_BLOCKS_TO_KEEP);
    int count=0;
    for (int fileNumber = 0; fileNumber < nLastBlockFile; fileNumber++) {
        if (vinfoBlockFile[fileNumber].nSize == 0 || vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune)
            continue;
        PruneOneBlockFile(fileNumber);
        setFilesToPrune.insert(fileNumber);
        count++;
    }
    LogPrintf("Prune (Manual): prune_height=%d removed %d blk/rev pairs\n", nLastBlockWeCanPrune, count);
}
/* Calculate the block/rev files to delete based on height specified by user with RPC command pruneblockchain */
Calculate the block/rev files to delete based on height specified by user with RPC command pruneblockchain
Calculate the block / rev files to delete based on height specified by user with RPC command pruneblockchain
void FindFilesToPruneManual(std::set<int>& setFilesToPrune, int nManualPruneHeight)
{
    assert(fPruneMode && nManualPruneHeight > 0);
    LOCK2(cs_main, cs_LastBlockFile);
    if (chainActive.Tip() == nullptr)
        return;
    unsigned int nLastBlockWeCanPrune = std::min(nManualPruneHeight, chainActive.Tip()->nHeight - MIN_BLOCKS_TO_KEEP);
    int count=0;
    for (int fileNumber = 0; fileNumber < nLastBlockFile; fileNumber++) {
        if (vinfoBlockFile[fileNumber].nSize == 0 || vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune)
            continue;
        PruneOneBlockFile(fileNumber);
        setFilesToPrune.insert(fileNumber);
        count++;
    }
    LogPrintf("Prune (Manual): prune_height=%d removed %d blk/rev pairs\n", nLastBlockWeCanPrune, count);
}
void FindFilesToPruneManual ( std :: set < int > & setFilesToPrune , int nManualPruneHeight ) { assert ( fPruneMode && nManualPruneHeight > 0 ) ; LOCK2 ( cs_main , cs_LastBlockFile ) ; if ( chainActive . Tip ( ) == nullptr ) return ; unsigned int nLastBlockWeCanPrune = std :: min ( nManualPruneHeight , chainActive . Tip ( ) -> nHeight - MIN_BLOCKS_TO_KEEP ) ; int count = 0 ; for ( int fileNumber = 0 ; fileNumber < nLastBlockFile ; fileNumber ++ ) { if ( vinfoBlockFile [ fileNumber ] . nSize == 0 || vinfoBlockFile [ fileNumber ] . nHeightLast > nLastBlockWeCanPrune ) continue ; PruneOneBlockFile ( fileNumber ) ; setFilesToPrune . insert ( fileNumber ) ; count ++ ; } LogPrintf ( " \n " , nLastBlockWeCanPrune , count ) ; }
Calculate the block/rev files to delete based on height specified by user with RPC command pruneblockchain
Calculate the block / rev files to delete based on height specified by user with RPC command pruneblockchain
// last block to prune is the lesser of (user-specified height, MIN_BLOCKS_TO_KEEP from the tip)