Bitcoin Core  0.20.99
P2P Digital Currency
Public Member Functions | Public Attributes | List of all members
NodeContext Struct Reference

NodeContext struct containing references to chain state and connection state. More...

#include <context.h>

Collaboration diagram for NodeContext:
[legend]

Public Member Functions

 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. More...
 
 ~NodeContext ()
 

Public Attributes

std::unique_ptr< CConnmanconnman
 
CTxMemPoolmempool {nullptr}
 
std::unique_ptr< PeerLogicValidationpeer_logic
 
ChainstateManagerchainman {nullptr}
 
std::unique_ptr< BanManbanman
 
ArgsManagerargs {nullptr}
 
std::unique_ptr< interfaces::Chainchain
 
std::vector< std::unique_ptr< interfaces::ChainClient > > chain_clients
 
std::unique_ptr< CSchedulerscheduler
 

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 34 of file context.h.

Constructor & Destructor Documentation

◆ NodeContext()

NodeContext::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.

Definition at line 13 of file context.cpp.

◆ ~NodeContext()

NodeContext::~NodeContext ( )

Definition at line 14 of file context.cpp.

Member Data Documentation

◆ args

ArgsManager* NodeContext::args {nullptr}

Definition at line 40 of file context.h.

◆ banman

std::unique_ptr<BanMan> NodeContext::banman

Definition at line 39 of file context.h.

◆ chain

std::unique_ptr<interfaces::Chain> NodeContext::chain

Definition at line 41 of file context.h.

◆ chain_clients

std::vector<std::unique_ptr<interfaces::ChainClient> > NodeContext::chain_clients

Definition at line 42 of file context.h.

◆ chainman

ChainstateManager* NodeContext::chainman {nullptr}

Definition at line 38 of file context.h.

◆ connman

std::unique_ptr<CConnman> NodeContext::connman

Definition at line 35 of file context.h.

◆ mempool

CTxMemPool* NodeContext::mempool {nullptr}

Definition at line 36 of file context.h.

◆ peer_logic

std::unique_ptr<PeerLogicValidation> NodeContext::peer_logic

Definition at line 37 of file context.h.

◆ scheduler

std::unique_ptr<CScheduler> NodeContext::scheduler

Definition at line 43 of file context.h.


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