Bitcoin ABC  0.22.15
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 } // namespace interfaces
24 
35 struct NodeContext {
36  std::unique_ptr<CConnman> connman;
37  // Currently a raw pointer because the memory is not managed by this struct
38  CTxMemPool *mempool{nullptr};
39  std::unique_ptr<PeerManager> peerman;
40  // Currently a raw pointer because the memory is not managed by this struct
41  ChainstateManager *chainman{nullptr};
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;
46  std::vector<std::unique_ptr<interfaces::ChainClient>> chain_clients;
47  std::unique_ptr<CScheduler> scheduler;
48  std::function<void()> rpc_interruption_point = [] {};
49 
53  NodeContext();
54  ~NodeContext();
55 };
56 
57 #endif // BITCOIN_NODE_CONTEXT_H
std::vector< std::unique_ptr< interfaces::ChainClient > > chain_clients
Definition: context.h:46
Definition: banman.h:58
std::unique_ptr< BanMan > banman
Definition: context.h:42
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:1037
std::unique_ptr< interfaces::Chain > chain
Definition: context.h:45
NodeContext struct containing references to chain state and connection state.
Definition: context.h:35
std::unique_ptr< CConnman > connman
Definition: context.h:36
Definition: net.h:167
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:468
std::unique_ptr< CScheduler > scheduler
Definition: context.h:47