Bitcoin Core  23.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 <kernel/context.h>
9 
10 #include <cassert>
11 #include <functional>
12 #include <memory>
13 #include <vector>
14 
15 class ArgsManager;
16 class BanMan;
17 class AddrMan;
19 class CConnman;
20 class CScheduler;
21 class CTxMemPool;
22 class ChainstateManager;
23 class NetGroupManager;
24 class PeerManager;
25 namespace interfaces {
26 class Chain;
27 class ChainClient;
28 class Init;
29 class WalletLoader;
30 } // namespace interfaces
31 
32 namespace node {
43 struct NodeContext {
45  std::unique_ptr<kernel::Context> kernel;
48  std::unique_ptr<AddrMan> addrman;
49  std::unique_ptr<CConnman> connman;
50  std::unique_ptr<CTxMemPool> mempool;
51  std::unique_ptr<const NetGroupManager> netgroupman;
52  std::unique_ptr<CBlockPolicyEstimator> fee_estimator;
53  std::unique_ptr<PeerManager> peerman;
54  std::unique_ptr<ChainstateManager> chainman;
55  std::unique_ptr<BanMan> banman;
56  ArgsManager* args{nullptr}; // Currently a raw pointer because the memory is not managed by this struct
57  std::unique_ptr<interfaces::Chain> chain;
59  std::vector<std::unique_ptr<interfaces::ChainClient>> chain_clients;
63  std::unique_ptr<CScheduler> scheduler;
64  std::function<void()> rpc_interruption_point = [] {};
65 
69  NodeContext();
70  ~NodeContext();
71 };
72 } // namespace node
73 
74 #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:38
node::NodeContext::~NodeContext
~NodeContext()
node::NodeContext::NodeContext
NodeContext()
Declare default constructor and destructor that are not inline, so code instantiating the NodeContext...
NetGroupManager
Netgroup manager.
Definition: netgroup.h:16
node::NodeContext::netgroupman
std::unique_ptr< const NetGroupManager > netgroupman
Definition: context.h:51
node::NodeContext::addrman
std::unique_ptr< AddrMan > addrman
Definition: context.h:48
CTxMemPool
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:431
node::NodeContext::peerman
std::unique_ptr< PeerManager > peerman
Definition: context.h:53
node::NodeContext
NodeContext struct containing references to chain state and connection state.
Definition: context.h:43
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:86
node::NodeContext::rpc_interruption_point
std::function< void()> rpc_interruption_point
Definition: context.h:64
node::NodeContext::fee_estimator
std::unique_ptr< CBlockPolicyEstimator > fee_estimator
Definition: context.h:52
node::NodeContext::mempool
std::unique_ptr< CTxMemPool > mempool
Definition: context.h:50
node::NodeContext::banman
std::unique_ptr< BanMan > banman
Definition: context.h:55
node::NodeContext::scheduler
std::unique_ptr< CScheduler > scheduler
Definition: context.h:63
CBlockPolicyEstimator
Definition: fees.h:132
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:59
PeerManager
Definition: net_processing.h:40
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:793
node::NodeContext::args
ArgsManager * args
Definition: context.h:56
CConnman
Definition: net.h:639
ArgsManager
Definition: system.h:172
node::NodeContext::kernel
std::unique_ptr< kernel::Context > kernel
libbitcoin_kernel context
Definition: context.h:45
init
Definition: bitcoin-gui.cpp:17
node::NodeContext::chainman
std::unique_ptr< ChainstateManager > chainman
Definition: context.h:54
node
Definition: init.h:25
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:62
node::NodeContext::connman
std::unique_ptr< CConnman > connman
Definition: context.h:49
context.h
node::NodeContext::chain
std::unique_ptr< interfaces::Chain > chain
Definition: context.h:57