Skip to content

Commit d35b121

Browse files
committed
Merge #17044: init: Remove auto-import of bootstrap.dat and associated code
104f7de remove old bootstrap relevant code (tryphe) Pull request description: This picks up #15954 I fixed the code and added at a functional test utilizing the scripts in `contrib/linearize` as suggested by @MarcoFalke . ACKs for top commit: laanwj: ACK 104f7de Tree-SHA512: acac9f285f9785fcbc3afc78118461e45bec2962f90ab90e9f82f3ad28adc90a44f0443b712458ccf486e46d891eb8a67f53e7bee5fa6d89e4387814fe03f117
2 parents 22e7eea + 104f7de commit d35b121

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

doc/developer-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ Threads
384384

385385
- ThreadScriptCheck : Verifies block scripts.
386386

387-
- ThreadImport : Loads blocks from blk*.dat files or bootstrap.dat.
387+
- ThreadImport : Loads blocks from `blk*.dat` files or `-loadblock=<file>`.
388388

389389
- StartNode : Starts other threads.
390390

doc/release-notes-15954.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Configuration option changes
2+
-----------------------------
3+
4+
Importing blocks upon startup via the `bootstrap.dat` file no longer occurs by default. The file must now be specified with `-loadblock=<file>`.

src/init.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ void SetupServerArgs()
372372
gArgs.AddArg("-debuglogfile=<file>", strprintf("Specify location of debug log file. Relative paths will be prefixed by a net-specific datadir location. (-nodebuglogfile to disable; default: %s)", DEFAULT_DEBUGLOGFILE), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
373373
gArgs.AddArg("-feefilter", strprintf("Tell other nodes to filter invs to us by our mempool min fee (default: %u)", DEFAULT_FEEFILTER), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
374374
gArgs.AddArg("-includeconf=<file>", "Specify additional configuration file, relative to the -datadir path (only useable from configuration file, not command line)", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
375-
gArgs.AddArg("-loadblock=<file>", "Imports blocks from external blk000??.dat file on startup", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
375+
gArgs.AddArg("-loadblock=<file>", "Imports blocks from external file on startup", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
376376
gArgs.AddArg("-maxmempool=<n>", strprintf("Keep the transaction memory pool below <n> megabytes (default: %u)", DEFAULT_MAX_MEMPOOL_SIZE), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
377377
gArgs.AddArg("-maxorphantx=<n>", strprintf("Keep at most <n> unconnectable transactions in memory (default: %u)", DEFAULT_MAX_ORPHAN_TRANSACTIONS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
378378
gArgs.AddArg("-mempoolexpiry=<n>", strprintf("Do not keep transactions in the mempool longer than <n> hours (default: %u)", DEFAULT_MEMPOOL_EXPIRY), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
@@ -684,20 +684,6 @@ static void ThreadImport(std::vector<fs::path> vImportFiles)
684684
LoadGenesisBlock(chainparams);
685685
}
686686

687-
// hardcoded $DATADIR/bootstrap.dat
688-
fs::path pathBootstrap = GetDataDir() / "bootstrap.dat";
689-
if (fs::exists(pathBootstrap)) {
690-
FILE *file = fsbridge::fopen(pathBootstrap, "rb");
691-
if (file) {
692-
fs::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
693-
LogPrintf("Importing bootstrap.dat...\n");
694-
LoadExternalBlockFile(chainparams, file);
695-
RenameOver(pathBootstrap, pathBootstrapOld);
696-
} else {
697-
LogPrintf("Warning: Could not open bootstrap file %s\n", pathBootstrap.string());
698-
}
699-
}
700-
701687
// -loadblock=
702688
for (const fs::path& path : vImportFiles) {
703689
FILE *file = fsbridge::fopen(path, "rb");

0 commit comments

Comments
 (0)