src/validation.cpp
void PruneOneBlockFile(const int fileNumber)
{
    for (const auto& entry : mapBlockIndex) {
        CBlockIndex* pindex = entry.second;
        if (pindex->nFile == fileNumber) {
            pindex->nStatus &= ~BLOCK_HAVE_DATA;
            pindex->nStatus &= ~BLOCK_HAVE_UNDO;
            pindex->nFile = 0;
            pindex->nDataPos = 0;
            pindex->nUndoPos = 0;
            setDirtyBlockIndex.insert(pindex);

            // Prune from mapBlocksUnlinked -- any block we prune would have
            // to be downloaded again in order to consider its chain, at which
            // point it would be considered as a candidate for
            // mapBlocksUnlinked or setBlockIndexCandidates.
            std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> range = mapBlocksUnlinked.equal_range(pindex->pprev);
            while (range.first != range.second) {
                std::multimap<CBlockIndex *, CBlockIndex *>::iterator _it = range.first;
                range.first++;
                if (_it->second == pindex) {
                    mapBlocksUnlinked.erase(_it);
                }
            }
        }
    }

    vinfoBlockFile[fileNumber].SetNull();
    setDirtyFileInfo.insert(fileNumber);
}
/* Prune a block file (modify associated database entries)*/
Prune a block file (modify associated database entries)
Prune a block file ( modify associated database entries )
void PruneOneBlockFile(const int fileNumber)
{
    for (const auto& entry : mapBlockIndex) {
        CBlockIndex* pindex = entry.second;
        if (pindex->nFile == fileNumber) {
            pindex->nStatus &= ~BLOCK_HAVE_DATA;
            pindex->nStatus &= ~BLOCK_HAVE_UNDO;
            pindex->nFile = 0;
            pindex->nDataPos = 0;
            pindex->nUndoPos = 0;
            setDirtyBlockIndex.insert(pindex);
            std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> range = mapBlocksUnlinked.equal_range(pindex->pprev);
            while (range.first != range.second) {
                std::multimap<CBlockIndex *, CBlockIndex *>::iterator _it = range.first;
                range.first++;
                if (_it->second == pindex) {
                    mapBlocksUnlinked.erase(_it);
                }
            }
        }
    }
    vinfoBlockFile[fileNumber].SetNull();
    setDirtyFileInfo.insert(fileNumber);
}
void PruneOneBlockFile ( const int fileNumber ) { for ( const auto & entry : mapBlockIndex ) { CBlockIndex * pindex = entry . second ; if ( pindex -> nFile == fileNumber ) { pindex -> nStatus &= ~ BLOCK_HAVE_DATA ; pindex -> nStatus &= ~ BLOCK_HAVE_UNDO ; pindex -> nFile = 0 ; pindex -> nDataPos = 0 ; pindex -> nUndoPos = 0 ; setDirtyBlockIndex . insert ( pindex ) ; std :: pair < std :: multimap < CBlockIndex * , CBlockIndex * > :: iterator , std :: multimap < CBlockIndex * , CBlockIndex * > :: iterator > range = mapBlocksUnlinked . equal_range ( pindex -> pprev ) ; while ( range . first != range . second ) { std :: multimap < CBlockIndex * , CBlockIndex * > :: iterator _it = range . first ; range . first ++ ; if ( _it -> second == pindex ) { mapBlocksUnlinked . erase ( _it ) ; } } } } vinfoBlockFile [ fileNumber ] . SetNull ( ) ; setDirtyFileInfo . insert ( fileNumber ) ; }
Prune a block file (modify associated database entries)
Prune a block file ( modify associated database entries )
// Prune from mapBlocksUnlinked -- any block we prune would have // to be downloaded again in order to consider its chain, at which // point it would be considered as a candidate for // mapBlocksUnlinked or setBlockIndexCandidates.