Bitcoin Core  22.99.0
P2P Digital Currency
context.h
Go to the documentation of this file.
1 // Copyright (c) 2019-2021 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_NODE_CONTEXT_H
6 #define BITCOIN_NODE_CONTEXT_H
7 
8 #include <cassert>
9 #include <functional>
10 #include <memory>
11 #include <vector>
12 
13 class ArgsManager;
14 class BanMan;
15 class AddrMan;
17 class CConnman;
18 class CScheduler;
19 class CTxMemPool;
20 class ChainstateManager;
21 class PeerManager;
22 namespace interfaces {
23 class Chain;
24 class ChainClient;
25 class Init;
26 class WalletLoader;
27 } // namespace interfaces
28 
29 namespace node {
40 struct NodeContext {
43  std::unique_ptr<AddrMan> addrman;
44  std::unique_ptr<CConnman> connman;
45  std::unique_ptr<CTxMemPool> mempool;
46  std::unique_ptr<CBlockPolicyEstimator> fee_estimator;
47  std::unique_ptr<PeerManager> peerman;
48  std::unique_ptr<ChainstateManager> chainman;
49  std::unique_ptr<BanMan> banman;
50  ArgsManager* args{nullptr}; // Currently a raw pointer because the memory is not managed by this struct
51  std::unique_ptr<interfaces::Chain> chain;
53  std::vector<std::unique_ptr<interfaces::ChainClient>> chain_clients;
57  std::unique_ptr<CScheduler> scheduler;
58  std::function<void()> rpc_interruption_point = [] {};
59 
63  NodeContext();
64  ~NodeContext();
65 };
66 } // namespace node
67 
68 #endif // BITCOIN_NODE_CONTEXT_H
interfaces
Definition: dummywallet.cpp:10
CScheduler
Simple class for background tasks that should be run periodically or once "after a while".
Definition: scheduler.h:33
node::NodeContext::~NodeContext
~NodeContext()
Definition: context.cpp:19
node::NodeContext::NodeContext
NodeContext()
Declare default constructor and destructor that are not inline, so code instantiating the NodeContext...
Definition: context.cpp:18
node::NodeContext::addrman
std::unique_ptr< AddrMan > addrman
Definition: context.h:43
CTxMemPool
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:429
node::NodeContext::peerman
std::unique_ptr< PeerManager > peerman
Definition: context.h:47
node::NodeContext
NodeContext struct containing references to chain state and connection state.
Definition: context.h:40
interfaces::Init
Initial interface created when a process is first started, and used to give and get access to other i...
Definition: init.h:28
AddrMan
Stochastic address manager.
Definition: addrman.h:79
node::NodeContext::rpc_interruption_point
std::function< void()> rpc_interruption_point
Definition: context.h:58
node::NodeContext::fee_estimator
std::unique_ptr< CBlockPolicyEstimator > fee_estimator
Definition: context.h:46
node::NodeContext::mempool
std::unique_ptr< CTxMemPool > mempool
Definition: context.h:45
node::NodeContext::banman
std::unique_ptr< BanMan > banman
Definition: context.h:49
node::NodeContext::scheduler
std::unique_ptr< CScheduler > scheduler
Definition: context.h:57
CBlockPolicyEstimator
Definition: fees.h:131
interfaces::WalletLoader
Wallet chain client that in addition to having chain client methods for starting up,...
Definition: wallet.h:319
node::NodeContext::chain_clients
std::vector< std::unique_ptr< interfaces::ChainClient > > chain_clients
List of all chain clients (wallet processes or other client) connected to node.
Definition: context.h:53
PeerManager
Definition: net_processing.h:37
BanMan
Definition: banman.h:58
ChainstateManager
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:777
node::NodeContext::args
ArgsManager * args
Definition: context.h:50
CConnman
Definition: net.h:741
ArgsManager
Definition: system.h:158
init
Definition: bitcoin-gui.cpp:16
node::NodeContext::chainman
std::unique_ptr< ChainstateManager > chainman
Definition: context.h:48
node
Definition: init.h:22
node::NodeContext::wallet_loader
interfaces::WalletLoader * wallet_loader
Reference to chain client that should used to load or create wallets opened by the gui.
Definition: context.h:56
node::NodeContext::connman
std::unique_ptr< CConnman > connman
Definition: context.h:44
node::NodeContext::chain
std::unique_ptr< interfaces::Chain > chain
Definition: context.h:51