![]() |
Bitcoin Core 32.1.0
P2P Digital Currency
|
#include <bitcoin-build-config.h>#include <init.h>#include <addrdb.h>#include <addrman.h>#include <banman.h>#include <blockfilter.h>#include <chain.h>#include <chainparams.h>#include <chainparamsbase.h>#include <clientversion.h>#include <common/args.h>#include <common/messages.h>#include <common/system.h>#include <compat/compat.h>#include <consensus/params.h>#include <crypto/hex_base.h>#include <dbwrapper.h>#include <httprpc.h>#include <httpserver.h>#include <index/base.h>#include <index/blockfilterindex.h>#include <index/coinstatsindex.h>#include <index/txindex.h>#include <index/txospenderindex.h>#include <init/common.h>#include <interfaces/chain.h>#include <interfaces/init.h>#include <interfaces/ipc.h>#include <interfaces/mining.h>#include <interfaces/node.h>#include <ipc/exception.h>#include <kernel/blockmanager_opts.h>#include <kernel/caches.h>#include <kernel/chainstatemanager_opts.h>#include <kernel/checks.h>#include <kernel/context.h>#include <kernel/notifications_interface.h>#include <key.h>#include <logging.h>#include <mapport.h>#include <net.h>#include <net_permissions.h>#include <net_processing.h>#include <netaddress.h>#include <netbase.h>#include <netgroup.h>#include <node/blockmanager_args.h>#include <node/blockstorage.h>#include <node/caches.h>#include <node/chainstate.h>#include <node/chainstatemanager_args.h>#include <node/context.h>#include <node/interface_ui.h>#include <node/kernel_notifications.h>#include <node/mempool_args.h>#include <node/mempool_persist.h>#include <node/mempool_persist_args.h>#include <node/mining_args.h>#include <node/mining_types.h>#include <node/peerman_args.h>#include <policy/feerate.h>#include <policy/fees/block_policy_estimator.h>#include <policy/fees/estimator_args.h>#include <policy/fees/estimator_man.h>#include <policy/policy.h>#include <policy/settings.h>#include <protocol.h>#include <random.h>#include <rpc/register.h>#include <rpc/server.h>#include <rpc/util.h>#include <scheduler.h>#include <script/sigcache.h>#include <sync.h>#include <tinyformat.h>#include <torcontrol.h>#include <txgraph.h>#include <txmempool.h>#include <uint256.h>#include <util/asmap.h>#include <util/batchpriority.h>#include <util/btcsignals.h>#include <util/byte_units.h>#include <util/chaintype.h>#include <util/check.h>#include <util/fs.h>#include <util/fs_helpers.h>#include <util/moneystr.h>#include <util/result.h>#include <util/signalinterrupt.h>#include <util/strencodings.h>#include <util/string.h>#include <util/syserror.h>#include <util/thread.h>#include <util/threadnames.h>#include <util/time.h>#include <util/translation.h>#include <validation.h>#include <validationinterface.h>#include <walletinitinterface.h>#include <algorithm>#include <any>#include <cerrno>#include <condition_variable>#include <cstddef>#include <cstdint>#include <exception>#include <fstream>#include <functional>#include <limits>#include <list>#include <memory>#include <new>#include <optional>#include <set>#include <span>#include <string>#include <system_error>#include <thread>#include <tuple>#include <utility>#include <vector>#include <csignal>Go to the source code of this file.
Classes | |
| class | BlockManager |
| Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most-work tip is. More... | |
| class | KernelNotifications |
Macros | |
| #define | MIN_LEVELDB_FDS 150 |
Typedefs | |
| using | ChainstateLoadResult |
| Chainstate load status code and optional error string. | |
Enumerations | |
| enum class | ChainstateLoadStatus |
Functions | |
| static fs::path | GetPidFile (const ArgsManager &args) |
| static bool | CreatePidFile (const ArgsManager &args) |
| static void | RemovePidFile (const ArgsManager &args) |
| void | InitContext (NodeContext &node) |
| Initialize node context shutdown and args variables. | |
| bool | ShutdownRequested (node::NodeContext &node) |
| Return whether node shutdown was requested. | |
| void | Interrupt (NodeContext &node) |
| Interrupt threads. | |
| void | Shutdown (NodeContext &node) |
| static void | HandleSIGTERM (int) |
| Signal handlers are very limited in what they are allowed to do. | |
| static void | HandleSIGHUP (int) |
| static void | registerSignalHandler (int signal, void(*handler)(int)) |
| void | SetupServerArgs (ArgsManager &argsman, bool can_listen_ipc) |
| Register all arguments with the ArgsManager. | |
| static bool | AppInitServers (NodeContext &node) |
| void | InitParameterInteraction (ArgsManager &args) |
| Parameter interaction: change current parameters depending on various rules. | |
| void | InitLogging (const ArgsManager &args) |
| Initialize global loggers. | |
| static void | new_handler_terminate () |
| bool | AppInitBasicSetup (const ArgsManager &args, std::atomic< int > &exit_status) |
| Initialize bitcoin core: Basic context setup. | |
| bool | AppInitParameterInteraction (const ArgsManager &args) |
| Initialization: parameter interaction. | |
| static bool | LockDirectory (const fs::path &dir, bool probeOnly) |
| static bool | LockDirectories (bool probeOnly) |
| bool | AppInitSanityChecks (const kernel::Context &kernel) |
| Initialization sanity checks. | |
| bool | AppInitLockDirectories () |
| Lock bitcoin core critical directories. | |
| bool | AppInitInterfaces (NodeContext &node) |
| Initialize node and wallet interface pointers. | |
| bool | CheckHostPortOptions (const ArgsManager &args) |
| static std::optional< CService > | CheckBindingConflicts (const CConnman::Options &conn_options) |
| Checks for duplicate bindings across all binding configurations. | |
| static ChainstateLoadResult | InitAndLoadChainstate (NodeContext &node, bool do_reindex, const bool do_reindex_chainstate, const kernel::CacheSizes &cache_sizes, const ArgsManager &args) |
| bool | AppInitMain (NodeContext &node, interfaces::BlockAndHeaderTipInfo *tip_info) |
| Bitcoin core main initialization. | |
| bool | StartIndexBackgroundSync (NodeContext &node) |
| Validates requirements to run the indexes and spawns each index initial sync thread. | |
| bilingual_str | InvalidPortErrMsg (const std::string &optname, const std::string &invalid_value) |
| bilingual_str | ResolveErrMsg (const std::string &optname, const std::string &strBind) |
| util::Result< void > | ApplyArgsManOptions (const ArgsManager &args, BlockManager::Options &opts) |
| CacheSizes | CalculateCacheSizes (const ArgsManager &args, size_t n_indexes) |
| bool | DumpMempool (const CTxMemPool &pool, const fs::path &dump_path, fsbridge::FopenFn mockable_fopen_function=fsbridge::fopen, bool skip_file_commit=false) |
| Dump the mempool to a file. | |
| void | ImportBlocks (ChainstateManager &chainman, std::span< const fs::path > import_paths) |
| ChainstateLoadResult | LoadChainstate (ChainstateManager &chainman, const CacheSizes &cache_sizes, const ChainstateLoadOptions &options) |
| bool | LoadMempool (CTxMemPool &pool, const fs::path &load_path, Chainstate &active_chainstate, ImportMempoolOptions &&opts) |
| Import the file and attempt to add its contents to the mempool. | |
| fs::path | MempoolPath (const ArgsManager &argsman) |
| bool | ShouldPersistMempool (const ArgsManager &argsman) |
| ChainstateLoadResult | VerifyLoadedChainstate (ChainstateManager &chainman, const ChainstateLoadOptions &options) |
| template<typename C, typename S, typename UnaryOp> | |
| auto | Join (const C &container, const S &separator, UnaryOp unary_op) |
| Join all container items. | |
| void | ReplaceAll (std::string &in_out, std::string_view search, std::string_view substitute) |
| Replace every non-overlapping occurrence of search with substitute, treating both literally; the replacement text is not searched again. | |
| template<typename T> | |
| std::string | ToString (const T &t) |
| Locale-independent version of std::to_string. | |
| std::string_view | TrimStringView (std::string_view str LIFETIMEBOUND, std::string_view pattern=" \f\n\r\t\v") |
Variables | |
| 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} |
| static constexpr int | MIN_CORE_FDS = MIN_LEVELDB_FDS + NUM_FDS_MESSAGE_CAPTURE |
| static const char * | BITCOIN_PID_FILENAME = "bitcoind.pid" |
| The PID file facilities. | |
| static bool | g_generated_pid {false} |
| True if this process has created a PID file. | |
| static std::optional< util::SignalInterrupt > | g_shutdown |
| constexpr bool | DEFAULT_PERSIST_MEMPOOL |
| Default for -persistmempool, indicating whether the node should attempt to automatically load the mempool on start and save to disk on shutdown. | |
| constexpr bool | DEFAULT_PRINT_MODIFIED_FEE |
| constexpr int | DEFAULT_STOPATHEIGHT |
Chainstate load status code and optional error string.
Definition at line 54 of file chainstate.h.
|
strong |
Chainstate load status. Simple applications can just check for the success case, and treat other cases as errors. More complex applications may want to try reindexing in the generic failure case, and pass an interrupt callback and exit cleanly in the interrupted case.
Definition at line 44 of file chainstate.h.
| bool AppInitBasicSetup | ( | const ArgsManager & | args, |
| std::atomic< int > & | exit_status ) |
Initialize bitcoin core: Basic context setup.
Definition at line 912 of file init.cpp.
| bool AppInitInterfaces | ( | node::NodeContext & | node | ) |
| bool AppInitLockDirectories | ( | ) |
Lock bitcoin core critical directories.
Definition at line 1267 of file init.cpp.
| bool AppInitMain | ( | node::NodeContext & | node, |
| interfaces::BlockAndHeaderTipInfo * | tip_info = nullptr ) |
Bitcoin core main initialization.
Definition at line 1496 of file init.cpp.
| bool AppInitParameterInteraction | ( | const ArgsManager & | args | ) |
Initialization: parameter interaction.
Definition at line 949 of file init.cpp.
| bool AppInitSanityChecks | ( | const kernel::Context & | kernel | ) |
Initialization sanity checks.
Definition at line 1248 of file init.cpp.
|
static |
|
nodiscard |
Definition at line 19 of file blockmanager_args.cpp.
| CacheSizes node::CalculateCacheSizes | ( | const ArgsManager & | args, |
| size_t | n_indexes = 0 ) |
Definition at line 57 of file caches.cpp.
|
static |
Checks for duplicate bindings across all binding configurations.
| [in] | conn_options | Connection options containing the binding vectors to check |
Definition at line 1343 of file init.cpp.
| bool CheckHostPortOptions | ( | const ArgsManager & | args | ) |
|
staticnodiscard |
| bool node::DumpMempool | ( | const CTxMemPool & | pool, |
| const fs::path & | dump_path, | ||
| fsbridge::FopenFn | mockable_fopen_function = fsbridge::fopen, | ||
| bool | skip_file_commit = false ) |
Dump the mempool to a file.
Definition at line 153 of file mempool_persist.cpp.
|
static |
|
static |
|
static |
Signal handlers are very limited in what they are allowed to do.
The execution context the handler is invoked in is not guaranteed, so we restrict handler operations to just touching variables:
Definition at line 443 of file init.cpp.
| void node::ImportBlocks | ( | ChainstateManager & | chainman, |
| std::span< const fs::path > | import_paths ) |
Definition at line 1276 of file blockstorage.cpp.
|
static |
| void InitContext | ( | NodeContext & | node | ) |
| void InitLogging | ( | const ArgsManager & | args | ) |
Initialize global loggers.
Initialize the logging infrastructure.
Note that this is called very early in the process lifetime, so you should be careful about what global state you rely on here.
Initialize global loggers.
Definition at line 883 of file init.cpp.
| void InitParameterInteraction | ( | ArgsManager & | args | ) |
| void Interrupt | ( | NodeContext & | node | ) |
| bilingual_str common::InvalidPortErrMsg | ( | const std::string & | optname, |
| const std::string & | invalid_value ) |
Definition at line 148 of file messages.cpp.
| auto util::Join | ( | const C & | container, |
| const S & | separator, | ||
| UnaryOp | unary_op ) |
| ChainstateLoadResult node::LoadChainstate | ( | ChainstateManager & | chainman, |
| const CacheSizes & | cache_sizes, | ||
| const ChainstateLoadOptions & | options ) |
| bool node::LoadMempool | ( | CTxMemPool & | pool, |
| const fs::path & | load_path, | ||
| Chainstate & | active_chainstate, | ||
| ImportMempoolOptions && | opts ) |
Import the file and attempt to add its contents to the mempool.
Definition at line 43 of file mempool_persist.cpp.
|
static |
|
static |
| fs::path node::MempoolPath | ( | const ArgsManager & | argsman | ) |
|
static |
|
static |
|
static |
| void util::ReplaceAll | ( | std::string & | in_out, |
| std::string_view | search, | ||
| std::string_view | substitute ) |
Replace every non-overlapping occurrence of search with substitute, treating both literally; the replacement text is not searched again.
Definition at line 14 of file string.cpp.
| bilingual_str common::ResolveErrMsg | ( | const std::string & | optname, |
| const std::string & | strBind ) |
| void SetupServerArgs | ( | ArgsManager & | argsman, |
| bool | can_listen_ipc ) |
Register all arguments with the ArgsManager.
Definition at line 477 of file init.cpp.
| bool node::ShouldPersistMempool | ( | const ArgsManager & | argsman | ) |
| void Shutdown | ( | NodeContext & | node | ) |
Note: Shutdown() must be able to handle cases in which initialization failed part of the way, for example if the data directory was found to be locked. Be sure that anything that writes files or flushes caches only does this if the respective module was initialized.
Definition at line 309 of file init.cpp.
| bool ShutdownRequested | ( | node::NodeContext & | node | ) |
| bool StartIndexBackgroundSync | ( | NodeContext & | node | ) |
| std::string util::ToString | ( | const T & | t | ) |
|
inlinenodiscard |
| ChainstateLoadResult node::VerifyLoadedChainstate | ( | ChainstateManager & | chainman, |
| const ChainstateLoadOptions & | options ) |
|
static |
|
inlineconstexpr |
Default for -persistmempool, indicating whether the node should attempt to automatically load the mempool on start and save to disk on shutdown.
Definition at line 18 of file mempool_persist_args.h.
|
inlineconstexpr |
Definition at line 15 of file mining_args.h.
|
inlineconstexpr |
Definition at line 29 of file kernel_notifications.h.
|
static |
|
static |
|
staticconstexpr |