Skip to content

Commit d69ca83

Browse files
committed
merge bitcoin#21727: Move more stuff to blockstorage
1 parent 6df927f commit d69ca83

File tree

9 files changed

+398
-356
lines changed

9 files changed

+398
-356
lines changed

src/index/txindex.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <index/disktxpos.h>
66
#include <index/txindex.h>
7+
#include <node/blockstorage.h>
78
#include <node/ui_interface.h>
89
#include <shutdown.h>
910
#include <util/system.h>

src/init.cpp

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -831,47 +831,6 @@ static void BlockNotifyGenesisWait(const CBlockIndex* pBlockIndex)
831831
}
832832
}
833833

834-
// If we're using -prune with -reindex, then delete block files that will be ignored by the
835-
// reindex. Since reindexing works by starting at block file 0 and looping until a blockfile
836-
// is missing, do the same here to delete any later block files after a gap. Also delete all
837-
// rev files since they'll be rewritten by the reindex anyway. This ensures that vinfoBlockFile
838-
// is in sync with what's actually on disk by the time we start downloading, so that pruning
839-
// works correctly.
840-
static void CleanupBlockRevFiles()
841-
{
842-
std::map<std::string, fs::path> mapBlockFiles;
843-
844-
// Glob all blk?????.dat and rev?????.dat files from the blocks directory.
845-
// Remove the rev files immediately and insert the blk file paths into an
846-
// ordered map keyed by block file index.
847-
LogPrintf("Removing unusable blk?????.dat and rev?????.dat files for -reindex with -prune\n");
848-
fs::path blocksdir = gArgs.GetBlocksDirPath();
849-
for (fs::directory_iterator it(blocksdir); it != fs::directory_iterator(); it++) {
850-
if (fs::is_regular_file(*it) &&
851-
it->path().filename().string().length() == 12 &&
852-
it->path().filename().string().substr(8,4) == ".dat")
853-
{
854-
if (it->path().filename().string().substr(0,3) == "blk")
855-
mapBlockFiles[it->path().filename().string().substr(3,5)] = it->path();
856-
else if (it->path().filename().string().substr(0,3) == "rev")
857-
remove(it->path());
858-
}
859-
}
860-
861-
// Remove all block files that aren't part of a contiguous set starting at
862-
// zero by walking the ordered map (keys are block file indices) by
863-
// keeping a separate counter. Once we hit a gap (or if 0 doesn't exist)
864-
// start removing block files.
865-
int nContigCounter = 0;
866-
for (const std::pair<const std::string, fs::path>& item : mapBlockFiles) {
867-
if (LocaleIndependentAtoi<int>(item.first) == nContigCounter) {
868-
nContigCounter++;
869-
continue;
870-
}
871-
remove(item.second);
872-
}
873-
}
874-
875834
#if HAVE_SYSTEM
876835
static void StartupNotify(const ArgsManager& args)
877836
{

src/llmq/instantsend.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <index/txindex.h>
1717
#include <masternode/sync.h>
1818
#include <net_processing.h>
19+
#include <node/blockstorage.h>
1920
#include <spork.h>
2021
#include <txmempool.h>
2122
#include <util/irange.h>

0 commit comments

Comments
 (0)