mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-11 12:03:04 +02:00
multiprocess: Add bitcoin-node process spawning support
Add bitcoin-node startup code to let it spawn and be spawned by other processes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user