Bitcoin Core 31.99.0
P2P Digital Currency
context.h
Go to the documentation of this file.
1// Copyright (c) 2019-present 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 <node/mining_types.h>
9
10#include <atomic>
11#include <cstdlib>
12#include <functional>
13#include <memory>
14#include <thread>
15#include <vector>
16
17class ArgsManager;
18class AddrMan;
19class BanMan;
20class BaseIndex;
22class CConnman;
24class CScheduler;
25class CTxMemPool;
27class ECC_Context;
28class NetGroupManager;
29class PeerManager;
30class TorController;
31namespace interfaces {
32class Chain;
33class ChainClient;
34class Mining;
35class Init;
36class WalletLoader;
37} // namespace interfaces
38namespace kernel {
39struct Context;
40}
41namespace util {
42class SignalInterrupt;
43}
44
45namespace node {
46class KernelNotifications;
47class Warnings;
48
61 std::unique_ptr<kernel::Context> kernel;
62 std::unique_ptr<ECC_Context> ecc_context;
66 std::function<bool()> shutdown_request;
69 std::unique_ptr<AddrMan> addrman;
70 std::unique_ptr<CConnman> connman;
71 std::unique_ptr<CTxMemPool> mempool;
72 std::unique_ptr<const NetGroupManager> netgroupman;
73 std::unique_ptr<CBlockPolicyEstimator> fee_estimator;
74 std::unique_ptr<PeerManager> peerman;
75 std::unique_ptr<TorController> tor_controller;
76 std::unique_ptr<ChainstateManager> chainman;
77 std::unique_ptr<BanMan> banman;
78 ArgsManager* args{nullptr}; // Currently a raw pointer because the memory is not managed by this struct
79 std::vector<BaseIndex*> indexes; // raw pointers because memory is not managed by this struct
80 std::unique_ptr<interfaces::Chain> chain;
82 std::vector<std::unique_ptr<interfaces::ChainClient>> chain_clients;
85 std::unique_ptr<interfaces::Mining> mining;
92 std::unique_ptr<CScheduler> scheduler;
93 std::function<void()> rpc_interruption_point = [] {};
95 std::unique_ptr<KernelNotifications> notifications;
97 std::unique_ptr<ValidationSignals> validation_signals;
98 std::atomic<int> exit_status{EXIT_SUCCESS};
100 std::unique_ptr<node::Warnings> warnings;
102
108};
109} // namespace node
110
111#endif // BITCOIN_NODE_CONTEXT_H
return EXIT_SUCCESS
Stochastic address manager.
Definition: addrman.h:114
Definition: banman.h:64
Base class for indices of blockchain data.
Definition: base.h:55
The BlockPolicyEstimator is used for estimating the feerate needed for a transaction to be included i...
Definition: net.h:1083
Simple class for background tasks that should be run periodically or once "after a while".
Definition: scheduler.h:39
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:187
Interface for managing multiple Chainstate objects, where each chainstate is associated with chainsta...
Definition: validation.h:945
RAII class initializing and deinitializing global state for elliptic curve support.
Definition: key.h:327
Definition: init.h:13
Netgroup manager.
Definition: netgroup.h:17
Controller that connects to Tor control socket, authenticate, then create and maintain an ephemeral o...
Definition: torcontrol.h:123
Initial interface created when a process is first started, and used to give and get access to other i...
Definition: init.h:32
Wallet chain client that in addition to having chain client methods for starting up,...
Definition: wallet.h:311
Helper class that manages an interrupt flag, and allows a thread or signal to interrupt another threa...
std::thread thread
Thread variable should be after other struct members so the thread does not start until the other mem...
is used externally by mining IPC clients, so it should only declare simple data definitions.
Definition: basic.cpp:8
Definition: messages.h:21
Block template creation options.
Definition: mining_types.h:33
NodeContext struct containing references to chain state and connection state.
Definition: context.h:59
std::unique_ptr< ValidationSignals > validation_signals
Issues calls about blocks and transactions.
Definition: context.h:97
std::unique_ptr< TorController > tor_controller
Definition: context.h:75
std::unique_ptr< CConnman > connman
Definition: context.h:70
std::unique_ptr< kernel::Context > kernel
libbitcoin_kernel context
Definition: context.h:61
BlockCreateOptions mining_args
Mining options used to create block templates.
Definition: context.h:90
std::vector< BaseIndex * > indexes
Definition: context.h:79
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:82
std::unique_ptr< CTxMemPool > mempool
Definition: context.h:71
std::unique_ptr< BanMan > banman
Definition: context.h:77
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:85
std::unique_ptr< AddrMan > addrman
Definition: context.h:69
std::function< void()> rpc_interruption_point
Definition: context.h:93
std::unique_ptr< ChainstateManager > chainman
Definition: context.h:76
std::unique_ptr< node::Warnings > warnings
Manages all the node warnings.
Definition: context.h:100
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:66
std::unique_ptr< KernelNotifications > notifications
Issues blocking calls about sync status, errors and warnings.
Definition: context.h:95
std::unique_ptr< CScheduler > scheduler
Definition: context.h:92
util::SignalInterrupt * shutdown_signal
Interrupt object used to track whether node shutdown was requested.
Definition: context.h:68
std::unique_ptr< CBlockPolicyEstimator > fee_estimator
Definition: context.h:73
std::unique_ptr< PeerManager > peerman
Definition: context.h:74
ArgsManager * args
Definition: context.h:78
std::atomic< int > exit_status
Definition: context.h:98
std::unique_ptr< const NetGroupManager > netgroupman
Definition: context.h:72
interfaces::WalletLoader * wallet_loader
Definition: context.h:91
std::thread background_init_thread
Definition: context.h:101
std::unique_ptr< ECC_Context > ecc_context
Definition: context.h:62
std::unique_ptr< interfaces::Chain > chain
Definition: context.h:80