MCPcopy Create free account
hub / github.com/LUX-Core/lux / PruneOneBlockFile

Function PruneOneBlockFile

src/main.cpp:5190–5219  ·  view source on GitHub ↗

Prune a block file (modify associated database entries)*/

Source from the content-addressed store, hash-verified

5188
5189/* Prune a block file (modify associated database entries)*/
5190void PruneOneBlockFile(const int fileNumber)
5191{
5192 for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); ++it) {
5193 CBlockIndex* pindex = it->second;
5194 if (pindex->nFile == fileNumber) {
5195 pindex->nStatus &= ~BLOCK_HAVE_DATA;
5196 pindex->nStatus &= ~BLOCK_HAVE_UNDO;
5197 pindex->nFile = 0;
5198 pindex->nDataPos = 0;
5199 pindex->nUndoPos = 0;
5200 setDirtyBlockIndex.insert(pindex);
5201
5202 // Prune from mapBlocksUnlinked -- any block we prune would have
5203 // to be downloaded again in order to consider its chain, at which
5204 // point it would be considered as a candidate for
5205 // mapBlocksUnlinked or setBlockIndexCandidates.
5206 std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> range = mapBlocksUnlinked.equal_range(pindex->pprev);
5207 while (range.first != range.second) {
5208 std::multimap<CBlockIndex *, CBlockIndex *>::iterator it = range.first;
5209 range.first++;
5210 if (it->second == pindex) {
5211 mapBlocksUnlinked.erase(it);
5212 }
5213 }
5214 }
5215 }
5216
5217 vinfoBlockFile[fileNumber].SetNull();
5218 setDirtyFileInfo.insert(fileNumber);
5219}
5220
5221
5222void UnlinkPrunedFiles(std::set<int>& setFilesToPrune)

Callers 2

FindFilesToPruneManualFunction · 0.85
FindFilesToPruneFunction · 0.85

Calls 6

beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
equal_rangeMethod · 0.45
eraseMethod · 0.45
SetNullMethod · 0.45

Tested by

no test coverage detected