Bitcoin Core 28.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
bitcoind.cpp File Reference
#include <config/bitcoin-config.h>
#include <chainparams.h>
#include <clientversion.h>
#include <common/args.h>
#include <common/init.h>
#include <common/system.h>
#include <compat/compat.h>
#include <init.h>
#include <interfaces/chain.h>
#include <interfaces/init.h>
#include <kernel/context.h>
#include <node/context.h>
#include <node/interface_ui.h>
#include <node/warnings.h>
#include <noui.h>
#include <util/check.h>
#include <util/exception.h>
#include <util/signalinterrupt.h>
#include <util/strencodings.h>
#include <util/syserror.h>
#include <util/threadnames.h>
#include <util/tokenpipe.h>
#include <util/translation.h>
#include <any>
#include <functional>
#include <optional>
Include dependency graph for bitcoind.cpp:

Go to the source code of this file.

Functions

int fork_daemon (bool nochdir, bool noclose, TokenPipeEnd &endpoint)
 Custom implementation of daemon().
 
static bool ParseArgs (ArgsManager &args, int argc, char *argv[])
 
static bool ProcessInitCommands (ArgsManager &args)
 
static bool AppInit (NodeContext &node)
 
 if (!init)
 
 SetupEnvironment ()
 
 noui_connect ()
 
 if (!ParseArgs(args, argc, argv)) return EXIT_FAILURE
 
 if (ProcessInitCommands(args)) return EXIT_SUCCESS
 
 if (!AppInit(node)||!Assert(node.shutdown) ->wait())
 
 Interrupt (node)
 
 Shutdown (node)
 

Variables

const std::function< std::string(const char *)> G_TRANSLATION_FUN = nullptr
 Translate string to current locale using Qt.
 
 MAIN_FUNCTION
 
int exit_status
 
std::unique_ptr< interfaces::Initinit = interfaces::MakeNodeInit(node, argc, argv, exit_status)
 
ArgsManagerargs = *Assert(node.args)
 

Function Documentation

◆ AppInit()

static bool AppInit ( NodeContext & node)
static

Definition at line 155 of file bitcoind.cpp.

Here is the call graph for this function:

◆ fork_daemon()

int fork_daemon ( bool nochdir,
bool noclose,
TokenPipeEnd & endpoint )

Custom implementation of daemon().

This implements the same order of operations as glibc. Opens a pipe to the child process to be able to wait for an event to occur.

Returns
0 if successful, and in child process. >0 if successful, and in parent process. -1 in case of error (in parent process).

In case of success, endpoint will be one end of a pipe from the child to parent process, which can be used with TokenWrite (in the child) or TokenRead (in the parent).

Definition at line 51 of file bitcoind.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ if() [1/4]

if ( ! AppInitnode)||!Assert(node.shutdown) ->wait()

Definition at line 276 of file bitcoind.cpp.

◆ if() [2/4]

if ( ! init)

Definition at line 258 of file bitcoind.cpp.

◆ if() [3/4]

if ( ! ParseArgsargs, argc, argv)

◆ if() [4/4]

◆ Interrupt()

Interrupt ( node )

◆ noui_connect()

noui_connect ( )

Definition at line 60 of file noui.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseArgs()

static bool ParseArgs ( ArgsManager & args,
int argc,
char * argv[] )
static

Definition at line 112 of file bitcoind.cpp.

Here is the call graph for this function:

◆ ProcessInitCommands()

static bool ProcessInitCommands ( ArgsManager & args)
static

Definition at line 134 of file bitcoind.cpp.

Here is the call graph for this function:

◆ SetupEnvironment()

SetupEnvironment ( )

Definition at line 59 of file system.cpp.

◆ Shutdown()

Shutdown ( node )

Variable Documentation

◆ args

ArgsManager& args = *Assert(node.args)

Definition at line 270 of file bitcoind.cpp.

◆ exit_status

return node exit_status

Definition at line 256 of file bitcoind.cpp.

◆ G_TRANSLATION_FUN

const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr

Translate string to current locale using Qt.

Translate a message to the native language of the user.

Definition at line 37 of file bitcoind.cpp.

◆ init

std::unique_ptr<interfaces::Init> init = interfaces::MakeNodeInit(node, argc, argv, exit_status)

Definition at line 257 of file bitcoind.cpp.

◆ MAIN_FUNCTION

MAIN_FUNCTION
Initial value:
{
NodeContext struct containing references to chain state and connection state.
Definition context.h:55

Definition at line 248 of file bitcoind.cpp.