Bitcoin Core 32.1.0
P2P Digital Currency
Loading...
Searching...
No Matches
NodeContext Struct Reference

#include <context.h>

Collaboration diagram for NodeContext:
[legend]

Public Member Functions

 NodeContext ()
 ~NodeContext ()

Public Attributes

std::unique_ptr< kernel::Context > kernel
 libbitcoin_kernel context
std::unique_ptr< ECC_Context > ecc_context
interfaces::Init * init {nullptr}
 Init interface for initializing current process and connecting to other processes.
std::function< bool()> shutdown_request
 Function to request a shutdown.
util::SignalInterrupt * shutdown_signal {nullptr}
 Interrupt object used to track whether node shutdown was requested.
std::unique_ptr< AddrMan > addrman
std::unique_ptr< CConnman > connman
std::unique_ptr< CTxMemPool > mempool
std::unique_ptr< const NetGroupManager > netgroupman
std::unique_ptr< FeeRateEstimatorManager > fee_estimator_man
std::unique_ptr< PeerManager > peerman
std::unique_ptr< TorController > tor_controller
std::unique_ptr< ChainstateManager > chainman
std::unique_ptr< BanMan > banman
ArgsManager * args {nullptr}
std::vector< BaseIndex * > indexes
std::unique_ptr< interfaces::Chain > chain
std::vector< std::unique_ptr< interfaces::ChainClient > > chain_clients
 List of all chain clients (wallet processes or other client) connected to node.
std::unique_ptr< interfaces::Mining > mining
BlockCreateOptions mining_args
interfaces::WalletLoader * wallet_loader {nullptr}
std::unique_ptr< CScheduler > scheduler
std::function< void()> rpc_interruption_point = [] {}
std::unique_ptr< KernelNotifications > notifications
 Issues blocking calls about sync status, errors and warnings.
std::unique_ptr< ValidationSignals > validation_signals
 Issues calls about blocks and transactions.
std::atomic< int > exit_status {EXIT_SUCCESS}
std::unique_ptr< node::Warnings > warnings
 Manages all the node warnings.
std::thread background_init_thread

Detailed Description

NodeContext struct containing references to chain state and connection state.

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.

Definition at line 59 of file context.h.

Constructor & Destructor Documentation

◆ NodeContext()

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.

◆ ~NodeContext()

Member Data Documentation

◆ addrman

Definition at line 69 of file context.h.

◆ args

Definition at line 78 of file context.h.

◆ background_init_thread

Definition at line 101 of file context.h.

◆ banman

Definition at line 77 of file context.h.

◆ chain

Definition at line 80 of file context.h.

◆ chain_clients

List of all chain clients (wallet processes or other client) connected to node.

Definition at line 82 of file context.h.

◆ chainman

Definition at line 76 of file context.h.

◆ connman

Definition at line 70 of file context.h.

◆ ecc_context

Definition at line 62 of file context.h.

◆ exit_status

Definition at line 98 of file context.h.

◆ fee_estimator_man

Definition at line 73 of file context.h.

◆ indexes

Definition at line 79 of file context.h.

◆ init

Init interface for initializing current process and connecting to other processes.

Definition at line 64 of file context.h.

◆ kernel

libbitcoin_kernel context

Definition at line 61 of file context.h.

◆ mempool

Definition at line 71 of file context.h.

◆ mining

Reference to chain client that should used to load or create wallets opened by the gui.

Definition at line 85 of file context.h.

◆ 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.

Definition at line 90 of file context.h.

◆ netgroupman

Definition at line 72 of file context.h.

◆ notifications

Issues blocking calls about sync status, errors and warnings.

Definition at line 95 of file context.h.

◆ peerman

Definition at line 74 of file context.h.

◆ rpc_interruption_point

std::function<void()> node::NodeContext::rpc_interruption_point = [] {}

Definition at line 93 of file context.h.

◆ scheduler

Definition at line 92 of file context.h.

◆ shutdown_request

std::function<bool()> node::NodeContext::shutdown_request

Function to request a shutdown.

Definition at line 66 of file context.h.

◆ shutdown_signal

Interrupt object used to track whether node shutdown was requested.

Definition at line 68 of file context.h.

◆ tor_controller

Definition at line 75 of file context.h.

◆ validation_signals

Issues calls about blocks and transactions.

Definition at line 97 of file context.h.

◆ wallet_loader

◆ warnings

Manages all the node warnings.

Definition at line 100 of file context.h.


The documentation for this struct was generated from the following files: