aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2023-07-11 09:46:11 -0400
committerRyan Ofsky <ryan@ofsky.org>2023-07-11 09:47:06 -0400
commite253568da8dc3693ad99aee260276233245e3d77 (patch)
tree31076f81c68b24633ce55b475d47f376cd3a7147 /src/init.cpp
parent21ed7846144fa3d2371ea652d48200af4d711f99 (diff)
parent462390c85f1174b3cf83dfb0f74922049e5cb8af (diff)
Merge bitcoin/bitcoin#28053: refactor: Move stopafterblockimport option out of blockstorage
462390c85f1174b3cf83dfb0f74922049e5cb8af refactor: Move stopafterblockimport handling out of blockstorage (TheCharlatan) Pull request description: This has the benefit of moving this StartShutdown call out of the blockstorage file and thus out of the kernel's responsibility. The user can now decide if he wants to start shutdown / interrupt after a block import or not. This also simplifies https://github.com/bitcoin/bitcoin/pull/28048, making it one fewer shutdown call to handle. ACKs for top commit: MarcoFalke: lgtm ACK 462390c85f1174b3cf83dfb0f74922049e5cb8af 🗝 ryanofsky: Code review ACK 462390c85f1174b3cf83dfb0f74922049e5cb8af. Just has been rebased and is a simpler change after #27607 Tree-SHA512: 84e58256b1c61f10e7ec5ecf32916f40a2ab1ea7cce703de0fa1c61ee2be94bd45ed32718bc99903b6eff3e6d3d5b506470bf567ddbb444a58232913918e8ab8
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index e96485b3aa..2f4eec060b 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -114,7 +114,6 @@
#include <zmq/zmqrpc.h>
#endif
-using kernel::DEFAULT_STOPAFTERBLOCKIMPORT;
using kernel::DumpMempool;
using kernel::ValidationCacheSizes;
@@ -136,6 +135,7 @@ using node::VerifyLoadedChainstate;
static constexpr bool DEFAULT_PROXYRANDOMIZE{true};
static constexpr bool DEFAULT_REST_ENABLE{false};
static constexpr bool DEFAULT_I2P_ACCEPT_INCOMING{true};
+static constexpr bool DEFAULT_STOPAFTERBLOCKIMPORT{false};
#ifdef WIN32
// Win32 LevelDB doesn't use filedescriptors, and the ones used for
@@ -1653,6 +1653,12 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
chainman.m_thread_load = std::thread(&util::TraceThread, "initload", [=, &chainman, &args, &node] {
// Import blocks
ImportBlocks(chainman, vImportFiles);
+ if (args.GetBoolArg("-stopafterblockimport", DEFAULT_STOPAFTERBLOCKIMPORT)) {
+ LogPrintf("Stopping after block import\n");
+ StartShutdown();
+ return;
+ }
+
// Start indexes initial sync
if (!StartIndexBackgroundSync(node)) {
bilingual_str err_str = _("Failed to start indexes, shutting down..");