![]() |
Bitcoin Core 31.0.0
P2P Digital Currency
|
#include <bitcoin-build-config.h>#include <init.h>#include <kernel/checks.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/system.h>#include <consensus/amount.h>#include <consensus/consensus.h>#include <deploymentstatus.h>#include <hash.h>#include <httprpc.h>#include <httpserver.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/caches.h>#include <kernel/context.h>#include <key.h>#include <logging.h>#include <mapport.h>#include <net.h>#include <net_permissions.h>#include <net_processing.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/miner.h>#include <node/peerman_args.h>#include <policy/feerate.h>#include <policy/fees/block_policy_estimator.h>#include <policy/fees/block_policy_estimator_args.h>#include <policy/policy.h>#include <policy/settings.h>#include <protocol.h>#include <rpc/blockchain.h>#include <rpc/register.h>#include <rpc/server.h>#include <rpc/util.h>#include <scheduler.h>#include <script/sigcache.h>#include <sync.h>#include <torcontrol.h>#include <txdb.h>#include <txmempool.h>#include <util/asmap.h>#include <util/batchpriority.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 <cerrno>#include <condition_variable>#include <cstddef>#include <cstdint>#include <cstdio>#include <fstream>#include <functional>#include <set>#include <string>#include <thread>#include <vector>#include <csignal>#include <sys/stat.h>#include <boost/signals2/signal.hpp>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 | AmountErrMsg (const std::string &optname, const std::string &strValue) |
| 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, const std::string &search, const std::string &substitute) |
| template<typename T> | |
| std::string | ToString (const T &t) |
| Locale-independent version of std::to_string. | |
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 |
| static 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. | |
| static const bool | DEFAULT_PRINT_MODIFIED_FEE |
| static 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.
| bilingual_str common::AmountErrMsg | ( | const std::string & | optname, |
| const std::string & | strValue ) |
| bool AppInitBasicSetup | ( | const ArgsManager & | args, |
| std::atomic< int > & | exit_status ) |
Initialize bitcoin core: Basic context setup.
Definition at line 882 of file init.cpp.
| bool AppInitInterfaces | ( | node::NodeContext & | node | ) |
| bool AppInitLockDirectories | ( | ) |
Lock bitcoin core critical directories.
Definition at line 1195 of file init.cpp.
| bool AppInitMain | ( | node::NodeContext & | node, |
| interfaces::BlockAndHeaderTipInfo * | tip_info = nullptr ) |
Bitcoin core main initialization.
Definition at line 1421 of file init.cpp.
| bool AppInitParameterInteraction | ( | const ArgsManager & | args | ) |
Initialization: parameter interaction.
Definition at line 919 of file init.cpp.
| bool AppInitSanityChecks | ( | const kernel::Context & | kernel | ) |
Initialization sanity checks.
Definition at line 1176 of file init.cpp.
|
static |
|
nodiscard |
| CacheSizes node::CalculateCacheSizes | ( | const ArgsManager & | args, |
| size_t | n_indexes = 0 ) |
Definition at line 57 of file caches.cpp.
|
static |
| 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 |
| void node::ImportBlocks | ( | ChainstateManager & | chainman, |
| std::span< const fs::path > | import_paths ) |
Definition at line 1261 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.
Definition at line 853 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 ) |
| auto util::Join | ( | const C & | container, |
| const S & | separator, | ||
| UnaryOp | unary_op ) |
Join all container items.
Typically used to concatenate strings but accepts containers with elements of any type.
| container | The items to join |
| separator | The separator |
| unary_op | Apply this operator to each item |
Definition at line 205 of file string.h.
| 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, |
| const std::string & | search, | ||
| const std::string & | substitute ) |
Definition at line 11 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 459 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 288 of file init.cpp.
| bool ShutdownRequested | ( | node::NodeContext & | node | ) |
| bool StartIndexBackgroundSync | ( | NodeContext & | node | ) |
| std::string util::ToString | ( | const T & | t | ) |
| ChainstateLoadResult node::VerifyLoadedChainstate | ( | ChainstateManager & | chainman, |
| const ChainstateLoadOptions & | options ) |
|
static |
|
staticconstexpr |
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.
|
static |
|
staticconstexpr |
Definition at line 30 of file kernel_notifications.h.
|
static |
|
static |
|
staticconstexpr |