diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-12-05 15:57:12 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2021-04-23 03:02:50 -0500 |
commit | ddf7ecc8dfc64cf121099fb047e1ac871de94f4c (patch) | |
tree | a0f922fe9b8ffc608a549e5693f1285c9c90c82d /src/bitcoind.cpp | |
parent | 10afdf0280fa93bfffb0a7665c60dc155cd84514 (diff) |
multiprocess: Add bitcoin-node process spawning support
Add bitcoin-node startup code to let it spawn and be spawned by other
processes
Diffstat (limited to 'src/bitcoind.cpp')
-rw-r--r-- | src/bitcoind.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 225b8b1ec4..cf9e4fad44 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -12,6 +12,7 @@ #include <compat.h> #include <init.h> #include <interfaces/chain.h> +#include <interfaces/init.h> #include <node/context.h> #include <node/ui_interface.h> #include <noui.h> @@ -104,10 +105,8 @@ int fork_daemon(bool nochdir, bool noclose, TokenPipeEnd& endpoint) #endif -static bool AppInit(int argc, char* argv[]) +static bool AppInit(NodeContext& node, int argc, char* argv[]) { - NodeContext node; - bool fRet = false; util::ThreadSetInternalName("init"); @@ -254,10 +253,18 @@ int main(int argc, char* argv[]) util::WinCmdLineArgs winArgs; std::tie(argc, argv) = winArgs.get(); #endif + + NodeContext node; + int exit_status; + std::unique_ptr<interfaces::Init> init = interfaces::MakeNodeInit(node, argc, argv, exit_status); + if (!init) { + return exit_status; + } + SetupEnvironment(); // Connect bitcoind signal handlers noui_connect(); - return (AppInit(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE); + return (AppInit(node, argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE); } |