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

Function DeleteAllBlockFiles

src/init.cpp:620–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618class Read;
619
620void DeleteAllBlockFiles()
621{
622 if (boost::filesystem::exists(GetBlockPosFilename(CDiskBlockPos(0, 0), "blk")))
623 return;
624
625 LogPrintf("Removing all blk?????.dat and rev?????.dat files for -reindex with -prune\n");
626 boost::filesystem::path blocksdir = GetDataDir() / "blocks";
627 for (boost::filesystem::directory_iterator it(blocksdir); it != boost::filesystem::directory_iterator(); it++) {
628 if (is_regular_file(*it)) {
629 if ((it->path().filename().string().length() == 12) &&
630 (it->path().filename().string().substr(8,4) == ".dat") &&
631 ((it->path().filename().string().substr(0,3) == "blk") ||
632 (it->path().filename().string().substr(0,3) == "rev")))
633 boost::filesystem::remove(it->path());
634 }
635 }
636}
637
638void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
639{

Callers 1

AppInit2Function · 0.85

Calls 3

GetBlockPosFilenameFunction · 0.85
CDiskBlockPosClass · 0.85
lengthMethod · 0.45

Tested by

no test coverage detected