Bitcoin ABC  0.24.10
P2P Digital Currency
context.h
Go to the documentation of this file.
1 // Copyright (c) 2019 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 CConnman;
16 class CScheduler;
17 class CTxMemPool;
18 class ChainstateManager;
19 class PeerManager;
20 namespace interfaces {
21 class Chain;
22 class ChainClient;
23 class WalletClient;
24 } // namespace interfaces
25 
36 struct NodeContext {
37  std::unique_ptr<CConnman> connman;
38  std::unique_ptr<CTxMemPool> mempool;
39  std::unique_ptr<PeerManager> peerman;
40  // Currently a raw pointer because the memory is not managed by this struct
42  std::unique_ptr<BanMan> banman;
43  // Currently a raw pointer because the memory is not managed by this struct
44  ArgsManager *args{nullptr};
45  std::unique_ptr<interfaces::Chain> chain;
48  std::vector<std::unique_ptr<interfaces::ChainClient>> chain_clients;
52  std::unique_ptr<CScheduler> scheduler;
53  std::function<void()> rpc_interruption_point = [] {};
54 
58  NodeContext();
59  ~NodeContext();
60 };
61 
62 #endif // BITCOIN_NODE_CONTEXT_H
interfaces
Definition: dummywallet.cpp:12
CScheduler
Simple class for background tasks that should be run periodically or once "after a while".
Definition: scheduler.h:35
NodeContext::~NodeContext
~NodeContext()
Definition: context.cpp:15
NodeContext::args
ArgsManager * args
Definition: context.h:44
NodeContext::mempool
std::unique_ptr< CTxMemPool > mempool
Definition: context.h:38
CTxMemPool
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:495
NodeContext::NodeContext
NodeContext()
Declare default constructor and destructor that are not inline, so code instantiating the NodeContext...
Definition: context.cpp:14
NodeContext::rpc_interruption_point
std::function< void()> rpc_interruption_point
Definition: context.h:53
NodeContext::chain
std::unique_ptr< interfaces::Chain > chain
Definition: context.h:45
PeerManager
Definition: net_processing.h:48
interfaces::WalletClient
Wallet chain client that in addition to having chain client methods for starting up,...
Definition: wallet.h:308
NodeContext::peerman
std::unique_ptr< PeerManager > peerman
Definition: context.h:39
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:1099
NodeContext::wallet_client
interfaces::WalletClient * wallet_client
Reference to chain client that should used to load or create wallets opened by the gui.
Definition: context.h:51
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:48
CConnman
Definition: net.h:963
NodeContext::banman
std::unique_ptr< BanMan > banman
Definition: context.h:42
ArgsManager
Definition: system.h:148
NodeContext::scheduler
std::unique_ptr< CScheduler > scheduler
Definition: context.h:52
NodeContext::connman
std::unique_ptr< CConnman > connman
Definition: context.h:37
NodeContext
NodeContext struct containing references to chain state and connection state.
Definition: context.h:36
NodeContext::chainman
ChainstateManager * chainman
Definition: context.h:41