Bitcoin Core  0.20.99
P2P Digital Currency
context.h
Go to the documentation of this file.
1 // Copyright (c) 2019-2020 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  ChainstateManager* chainman{nullptr}; // Currently a raw pointer because the memory is not managed by this struct
41  std::unique_ptr<BanMan> banman;
42  ArgsManager* args{nullptr}; // Currently a raw pointer because the memory is not managed by this struct
43  std::unique_ptr<interfaces::Chain> chain;
45  std::vector<std::unique_ptr<interfaces::ChainClient>> chain_clients;
48  interfaces::WalletClient* wallet_client{nullptr};
49  std::unique_ptr<CScheduler> scheduler;
50  std::function<void()> rpc_interruption_point = [] {};
51 
55  NodeContext();
56  ~NodeContext();
57 };
58 
59 #endif // BITCOIN_NODE_CONTEXT_H
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:45
Definition: banman.h:57
std::unique_ptr< BanMan > banman
Definition: context.h:41
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:781
std::unique_ptr< CTxMemPool > mempool
Definition: context.h:38
std::unique_ptr< interfaces::Chain > chain
Definition: context.h:43
Wallet chain client that in addition to having chain client methods for starting up, shutting down, and registering RPCs, also has additional methods (called by the GUI) to load and create wallets.
Definition: wallet.h:309
NodeContext struct containing references to chain state and connection state.
Definition: context.h:36
std::unique_ptr< CConnman > connman
Definition: context.h:37
Definition: net.h:180
std::unique_ptr< PeerManager > peerman
Definition: context.h:39
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:488
Simple class for background tasks that should be run periodically or once "after a while"...
Definition: scheduler.h:32
std::unique_ptr< CScheduler > scheduler
Definition: context.h:49