Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2009-2010 Satoshi Nakamoto2// Copyright (c) 2009-present The Bitcoin Core developers3// Distributed under the MIT software license, see the accompanying4// file COPYING or http://www.opensource.org/licenses/mit-license.php.6#ifndef BITCOIN_INIT_H7#define BITCOIN_INIT_H9#include <atomic>11//! Default value for -daemon option12inline constexpr bool DEFAULT_DAEMON = false;13//! Default value for -daemonwait option14inline constexpr bool DEFAULT_DAEMONWAIT = false;16class ArgsManager;17namespace interfaces {18struct BlockAndHeaderTipInfo;19}20namespace kernel {21struct Context;22}23namespace node {24struct NodeContext;25} // namespace node27/** Initialize node context shutdown and args variables. */28void InitContext(node::NodeContext& node);29/** Return whether node shutdown was requested. */30bool ShutdownRequested(node::NodeContext& node);32/** Interrupt threads */33void Interrupt(node::NodeContext& node);34void Shutdown(node::NodeContext& node);35//!Initialize the logging infrastructure36void InitLogging(const ArgsManager& args);37//!Parameter interaction: change current parameters depending on various rules38void InitParameterInteraction(ArgsManager& args);40/** Initialize bitcoin core: Basic context setup.41* @note This can be done before daemonization. Do not call Shutdown() if this function fails.42* @pre Parameters should be parsed and config file should be read.43*/44bool AppInitBasicSetup(const ArgsManager& args, std::atomic<int>& exit_status);45/**46* Initialization: parameter interaction.47* @note This can be done before daemonization. Do not call Shutdown() if this function fails.48* @pre Parameters should be parsed and config file should be read, AppInitBasicSetup should have been called.49*/50bool AppInitParameterInteraction(const ArgsManager& args);51/**52* Initialization sanity checks.53* @note This can be done before daemonization. Do not call Shutdown() if this function fails.54* @pre Parameters should be parsed and config file should be read, AppInitParameterInteraction should have been called.55*/56bool AppInitSanityChecks(const kernel::Context& kernel);57/**58* Lock bitcoin core critical directories.59* @note This should only be done after daemonization. Do not call Shutdown() if this function fails.60* @pre Parameters should be parsed and config file should be read, AppInitSanityChecks should have been called.61*/62bool AppInitLockDirectories();63/**64* Initialize node and wallet interface pointers. Has no prerequisites or side effects besides allocating memory.65*/66bool AppInitInterfaces(node::NodeContext& node);67/**68* Bitcoin core main initialization.69* @note This should only be done after daemonization. Call Shutdown() if this function fails.70* @pre Parameters should be parsed and config file should be read, AppInitLockDirectories should have been called.71*/72bool AppInitMain(node::NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info = nullptr);74/**75* Register all arguments with the ArgsManager76*/77void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc=false);79/** Validates requirements to run the indexes and spawns each index initial sync thread */80bool StartIndexBackgroundSync(node::NodeContext& node);82#endif // BITCOIN_INIT_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.