Bitcoin ABC 0.34.1
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 <kernel/context.h>
9
10#include <atomic>
11#include <cassert>
12#include <cstdlib>
13#include <functional>
14#include <memory>
15#include <thread>
16#include <vector>
17
18class ArgsManager;
19class AddrMan;
20class BanMan;
21class BaseIndex;
22class CConnman;
24class CScheduler;
25class CTxMemPool;
27class PeerManager;
28namespace interfaces {
29class Chain;
30class ChainClient;
31class WalletClient;
32} // namespace interfaces
33namespace avalanche {
34class Processor;
35} // namespace avalanche
36
37namespace node {
38class KernelNotifications;
39
52 std::unique_ptr<kernel::Context> kernel;
53 std::unique_ptr<AddrMan> addrman;
54 std::unique_ptr<CConnman> connman;
55 std::unique_ptr<CTxMemPool> mempool;
56 std::unique_ptr<PeerManager> peerman;
57 std::unique_ptr<ChainstateManager> chainman;
58 std::unique_ptr<BanMan> banman;
59 // Currently a raw pointer because the memory is not managed by this struct
60 ArgsManager *args{nullptr};
61 // raw pointers because memory is not managed by this struct
62 std::vector<BaseIndex *> indexes;
63 std::unique_ptr<interfaces::Chain> chain;
66 std::vector<std::unique_ptr<interfaces::ChainClient>> chain_clients;
70 std::unique_ptr<CScheduler> scheduler;
71 std::function<void()> rpc_interruption_point = [] {};
73 std::unique_ptr<KernelNotifications> notifications;
75 std::unique_ptr<ValidationSignals> validation_signals;
76 std::atomic<int> exit_status{EXIT_SUCCESS};
78
79 std::unique_ptr<avalanche::Processor> avalanche;
80
86};
87} // namespace node
88
89#endif // BITCOIN_NODE_CONTEXT_H
Stochastic address manager.
Definition: addrman.h:68
Definition: banman.h:59
Base class for indices of blockchain data.
Definition: base.h:37
Definition: net.h:838
Simple class for background tasks that should be run periodically or once "after a while".
Definition: scheduler.h:42
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:222
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:1176
Wallet chain client that in addition to having chain client methods for starting up,...
Definition: wallet.h:304
Definition: messages.h:12
NodeContext struct containing references to chain state and connection state.
Definition: context.h:50
std::unique_ptr< ValidationSignals > validation_signals
Issues calls about blocks and transactions.
Definition: context.h:75
std::vector< BaseIndex * > indexes
Definition: context.h:62
std::unique_ptr< CConnman > connman
Definition: context.h:54
std::unique_ptr< kernel::Context > kernel
libbitcoin_kernel context
Definition: context.h:52
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:66
std::unique_ptr< CTxMemPool > mempool
Definition: context.h:55
std::unique_ptr< BanMan > banman
Definition: context.h:58
std::unique_ptr< avalanche::Processor > avalanche
Definition: context.h:79
std::unique_ptr< AddrMan > addrman
Definition: context.h:53
std::function< void()> rpc_interruption_point
Definition: context.h:71
std::unique_ptr< ChainstateManager > chainman
Definition: context.h:57
NodeContext()
Declare default constructor and destructor that are not inline, so code instantiating the NodeContext...
std::unique_ptr< KernelNotifications > notifications
Issues blocking calls about sync status, errors and warnings.
Definition: context.h:73
std::unique_ptr< CScheduler > scheduler
Definition: context.h:70
interfaces::WalletClient * wallet_client
Reference to chain client that should used to load or create wallets opened by the gui.
Definition: context.h:69
std::unique_ptr< PeerManager > peerman
Definition: context.h:56
ArgsManager * args
Definition: context.h:60
std::atomic< int > exit_status
Definition: context.h:76
std::thread background_init_thread
Definition: context.h:77
std::unique_ptr< interfaces::Chain > chain
Definition: context.h:63