Bitcoin Core 28.99.0
P2P Digital Currency
context.h
Go to the documentation of this file.
1// Copyright (c) 2019-2022 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 <atomic>
9#include <cstdlib>
10#include <functional>
11#include <memory>
12#include <thread>
13#include <vector>
14
15class ArgsManager;
16class AddrMan;
17class BanMan;
18class BaseIndex;
20class CConnman;
22class CScheduler;
23class CTxMemPool;
25class ECC_Context;
26class NetGroupManager;
27class PeerManager;
28namespace interfaces {
29class Chain;
30class ChainClient;
31class Mining;
32class Init;
33class WalletLoader;
34} // namespace interfaces
35namespace kernel {
36struct Context;
37}
38namespace util {
39class SignalInterrupt;
40}
41
42namespace node {
43class KernelNotifications;
44class Warnings;
45
58 std::unique_ptr<kernel::Context> kernel;
59 std::unique_ptr<ECC_Context> ecc_context;
63 std::function<bool()> shutdown_request;
66 std::unique_ptr<AddrMan> addrman;
67 std::unique_ptr<CConnman> connman;
68 std::unique_ptr<CTxMemPool> mempool;
69 std::unique_ptr<const NetGroupManager> netgroupman;
70 std::unique_ptr<CBlockPolicyEstimator> fee_estimator;
71 std::unique_ptr<PeerManager> peerman;
72 std::unique_ptr<ChainstateManager> chainman;
73 std::unique_ptr<BanMan> banman;
74 ArgsManager* args{nullptr}; // Currently a raw pointer because the memory is not managed by this struct
75 std::vector<BaseIndex*> indexes; // raw pointers because memory is not managed by this struct
76 std::unique_ptr<interfaces::Chain> chain;
78 std::vector<std::unique_ptr<interfaces::ChainClient>> chain_clients;
81 std::unique_ptr<interfaces::Mining> mining;
83 std::unique_ptr<CScheduler> scheduler;
84 std::function<void()> rpc_interruption_point = [] {};
86 std::unique_ptr<KernelNotifications> notifications;
88 std::unique_ptr<ValidationSignals> validation_signals;
89 std::atomic<int> exit_status{EXIT_SUCCESS};
91 std::unique_ptr<node::Warnings> warnings;
93
99};
100} // namespace node
101
102#endif // BITCOIN_NODE_CONTEXT_H
return EXIT_SUCCESS
Stochastic address manager.
Definition: addrman.h:89
Definition: banman.h:59
Base class for indices of blockchain data.
Definition: base.h:43
The BlockPolicyEstimator is used for estimating the feerate needed for a transaction to be included i...
Definition: fees.h:149
Definition: net.h:1036
Simple class for background tasks that should be run periodically or once "after a while".
Definition: scheduler.h:40
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:304
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:866
RAII class initializing and deinitializing global state for elliptic curve support.
Definition: key.h:322
Netgroup manager.
Definition: netgroup.h:16
Initial interface created when a process is first started, and used to give and get access to other i...
Definition: init.h:31
Wallet chain client that in addition to having chain client methods for starting up,...
Definition: wallet.h:328
Helper class that manages an interrupt flag, and allows a thread or signal to interrupt another threa...
Definition: messages.h:20
NodeContext struct containing references to chain state and connection state.
Definition: context.h:56
std::unique_ptr< ValidationSignals > validation_signals
Issues calls about blocks and transactions.
Definition: context.h:88
std::unique_ptr< CConnman > connman
Definition: context.h:67
std::unique_ptr< kernel::Context > kernel
libbitcoin_kernel context
Definition: context.h:58
std::vector< BaseIndex * > indexes
Definition: context.h:75
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:78
std::unique_ptr< CTxMemPool > mempool
Definition: context.h:68
std::unique_ptr< BanMan > banman
Definition: context.h:73
std::unique_ptr< interfaces::Mining > mining
Reference to chain client that should used to load or create wallets opened by the gui.
Definition: context.h:81
std::unique_ptr< AddrMan > addrman
Definition: context.h:66
std::function< void()> rpc_interruption_point
Definition: context.h:84
std::unique_ptr< ChainstateManager > chainman
Definition: context.h:72
std::unique_ptr< node::Warnings > warnings
Manages all the node warnings.
Definition: context.h:91
NodeContext()
Declare default constructor and destructor that are not inline, so code instantiating the NodeContext...
std::function< bool()> shutdown_request
Function to request a shutdown.
Definition: context.h:63
std::unique_ptr< KernelNotifications > notifications
Issues blocking calls about sync status, errors and warnings.
Definition: context.h:86
std::unique_ptr< CScheduler > scheduler
Definition: context.h:83
util::SignalInterrupt * shutdown_signal
Interrupt object used to track whether node shutdown was requested.
Definition: context.h:65
std::unique_ptr< CBlockPolicyEstimator > fee_estimator
Definition: context.h:70
std::unique_ptr< PeerManager > peerman
Definition: context.h:71
ArgsManager * args
Definition: context.h:74
std::atomic< int > exit_status
Definition: context.h:89
std::unique_ptr< const NetGroupManager > netgroupman
Definition: context.h:69
interfaces::WalletLoader * wallet_loader
Definition: context.h:82
std::thread background_init_thread
Definition: context.h:92
std::unique_ptr< ECC_Context > ecc_context
Definition: context.h:59
std::unique_ptr< interfaces::Chain > chain
Definition: context.h:76