[#node-NodeContext] = xref:node.adoc[node]::NodeContext :relfileprefix: ../ :mrdocs: NodeContext struct containing references to chain state and connection state. == Synopsis Declared in `<node/context.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct NodeContext; ---- == Description This is used by init, rpc, and test code to pass object references around without needing to declare the same variables and parameters repeatedly, or to use globals. More variables could be added to this struct (particularly references to validation objects) to eliminate use of globals and make code more modular and testable. The struct isn't intended to have any member functions. It should just be a collection of references that can be used without pulling in unwanted dependencies or functionality. == Member Functions [cols="1,4"] |=== | Name| Description | xref:node/NodeContext/2constructor.adoc[`NodeContext`] [.small]#[constructor]# | Declare default constructor and destructor that are not inline, so code instantiating the NodeContext struct doesn't need to #include class definitions for all the unique_ptr members. | xref:node/NodeContext/2destructor.adoc[`~NodeContext`] [.small]#[destructor]# | Destroy the node context and release its owned members. |=== == Data Members [cols="1,4"] |=== | Name| Description | xref:node/NodeContext/addrman.adoc[`addrman`] | Address manager tracking known peer addresses. | xref:node/NodeContext/args.adoc[`args`] | Parsed command‐line and configuration arguments (memory not owned by this struct). | xref:node/NodeContext/background_init_thread.adoc[`background_init_thread`] | Background thread that performs the remainder of node initialization. | xref:node/NodeContext/banman.adoc[`banman`] | Tracks and persists banned and discouraged peers. | xref:node/NodeContext/chain.adoc[`chain`] | Interface giving access to the node's chain state. | xref:node/NodeContext/chain_clients.adoc[`chain_clients`] | List of all chain clients (wallet processes or other client) connected to node. | xref:node/NodeContext/chainman.adoc[`chainman`] | Owns and coordinates the active and background chainstates. | xref:node/NodeContext/connman.adoc[`connman`] | Manages the node's peer‐to‐peer network connections. | xref:node/NodeContext/ecc_context.adoc[`ecc_context`] | Owns the process‐wide libsecp256k1 signing and verification context. | xref:node/NodeContext/exit_status.adoc[`exit_status`] | Process exit status, set to a failure value when a fatal error occurs. | xref:node/NodeContext/fee_estimator_man.adoc[`fee_estimator_man`] | Tracks fee‐rate estimates derived from observed transactions. | xref:node/NodeContext/indexes.adoc[`indexes`] | Active optional block‐chain indexes (memory not owned by this struct). | xref:node/NodeContext/init.adoc[`init`] | Init interface for initializing current process and connecting to other processes. | xref:node/NodeContext/kernel.adoc[`kernel`] | libbitcoin_kernel context | xref:node/NodeContext/mempool.adoc[`mempool`] | The node's memory pool of unconfirmed transactions. | xref:node/NodeContext/mining.adoc[`mining`] | Reference to chain client that should used to load or create wallets opened by the gui. | xref:node/NodeContext/mining_args.adoc[`mining_args`] | Mining options used to create block templates. This value member is an exception to the dependency guidance above because BlockCreateOptions is a minimal dependency. It could be moved to the BlockTemplateCache proposed in bitcoin/bitcoin#33421. | xref:node/NodeContext/netgroupman.adoc[`netgroupman`] | Maps peer addresses to network groups for connection bucketing. | xref:node/NodeContext/notifications.adoc[`notifications`] | Issues blocking calls about sync status, errors and warnings | xref:node/NodeContext/peerman.adoc[`peerman`] | Drives peer‐to‐peer message processing and per‐peer state. | xref:node/NodeContext/rpc_interruption_point.adoc[`rpc_interruption_point`] | Hook invoked at interruption points during long‐running RPCs. | xref:node/NodeContext/scheduler.adoc[`scheduler`] | Runs deferred and recurring background tasks. | xref:node/NodeContext/shutdown_request.adoc[`shutdown_request`] | Function to request a shutdown. | xref:node/NodeContext/shutdown_signal.adoc[`shutdown_signal`] | Interrupt object used to track whether node shutdown was requested. | xref:node/NodeContext/tor_controller.adoc[`tor_controller`] | Manages the node's Tor hidden service and control connection. | xref:node/NodeContext/validation_signals.adoc[`validation_signals`] | Issues calls about blocks and transactions | xref:node/NodeContext/wallet_loader.adoc[`wallet_loader`] | Interface used to load or create wallets, owned elsewhere. | xref:node/NodeContext/warnings.adoc[`warnings`] | Manages all the node warnings |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:node/BroadcastTransaction.adoc[`BroadcastTransaction`] | Submit a transaction to the mempool and (optionally) relay it to all P2P peers. | xref:node/FindCoins.adoc[`FindCoins`] | Look up unspent output information. Returns coins in the mempool and in the current chain UTXO set. Iterates through all the keys in the map and populates the values. | xref:AppInitInterfaces.adoc[`::AppInitInterfaces`] | Initialize node and wallet interface pointers. Has no prerequisites or side effects besides allocating memory. | xref:AppInitMain.adoc[`::AppInitMain`] | Bitcoin core main initialization. | xref:CreateUTXOSnapshot.adoc[`::CreateUTXOSnapshot`] | Helper to create UTXO snapshots given a chainstate and a file handle. | xref:EnsureAddrman.adoc[`::EnsureAddrman`] | Get the address manager from a node context, asserting it is present. | xref:EnsureAnyNodeContext.adoc[`::EnsureAnyNodeContext`] | Extract the node context from an opaque RPC context, asserting it is present. | xref:EnsureArgsman.adoc[`::EnsureArgsman`] | Get the argument manager from a node context, asserting it is present. | xref:EnsureBanman.adoc[`::EnsureBanman`] | Get the ban manager from a node context, asserting it is present. | xref:EnsureChainman.adoc[`::EnsureChainman`] | Get the chainstate manager from a node context, asserting it is present. | xref:EnsureConnman.adoc[`::EnsureConnman`] | Get the connection manager from a node context, asserting it is present. | xref:EnsureFeeEstimatorMan.adoc[`::EnsureFeeEstimatorMan`] | Get the fee estimator from a node context, asserting it is present. | xref:EnsureMemPool.adoc[`::EnsureMemPool`] | Get the mempool from a node context, asserting it is present. | xref:EnsureMining.adoc[`::EnsureMining`] | Get the mining interface from a node context, asserting it is present. | xref:EnsurePeerman.adoc[`::EnsurePeerman`] | Get the peer manager from a node context, asserting it is present. | xref:InitContext.adoc[`::InitContext`] | Initialize node context shutdown and args variables. | xref:Interrupt.adoc[`::Interrupt`] | Interrupt threads | xref:Shutdown.adoc[`::Shutdown`] | Shut down the node, stopping threads and releasing resources. | xref:ShutdownRequested.adoc[`::ShutdownRequested`] | Return whether node shutdown was requested. | xref:StartIndexBackgroundSync.adoc[`::StartIndexBackgroundSync`] | Validates requirements to run the indexes and spawns each index initial sync thread |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#