Bitcoin Core 22.99.0
P2P Digital Currency
bitcoin-qt.cpp
Go to the documentation of this file.
1// Copyright (c) 2021 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#include <interfaces/chain.h>
6#include <interfaces/echo.h>
7#include <interfaces/init.h>
8#include <interfaces/node.h>
9#include <interfaces/wallet.h>
10#include <node/context.h>
11#include <util/system.h>
12
13#include <memory>
14
15namespace init {
16namespace {
17class BitcoinQtInit : public interfaces::Init
18{
19public:
20 BitcoinQtInit()
21 {
22 m_node.args = &gArgs;
23 m_node.init = this;
24 }
25 std::unique_ptr<interfaces::Node> makeNode() override { return interfaces::MakeNode(m_node); }
26 std::unique_ptr<interfaces::Chain> makeChain() override { return interfaces::MakeChain(m_node); }
27 std::unique_ptr<interfaces::WalletClient> makeWalletClient(interfaces::Chain& chain) override
28 {
29 return MakeWalletClient(chain, *Assert(m_node.args));
30 }
31 std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); }
33};
34} // namespace
35} // namespace init
36
37namespace interfaces {
38std::unique_ptr<Init> MakeGuiInit(int argc, char* argv[])
39{
40 return std::make_unique<init::BitcoinQtInit>();
41}
42} // namespace interfaces
NodeContext m_node
Definition: bitcoin-qt.cpp:32
#define Assert(val)
Identity function.
Definition: check.h:57
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition: chain.h:93
Initial interface created when a process is first started, and used to give and get access to other i...
Definition: init.h:27
std::unique_ptr< Chain > MakeChain(NodeContext &node)
Return implementation of Chain interface.
Definition: interfaces.cpp:714
std::unique_ptr< Echo > MakeEcho()
Return implementation of Echo interface.
Definition: echo.cpp:17
std::unique_ptr< Init > MakeGuiInit(int argc, char *argv[])
Return implementation of Init interface for the gui process.
Definition: bitcoin-gui.cpp:43
std::unique_ptr< WalletClient > MakeWalletClient(Chain &chain, ArgsManager &args)
Return implementation of ChainClient interface for a wallet client.
Definition: dummywallet.cpp:67
std::unique_ptr< Node > MakeNode(NodeContext &context)
Return implementation of Node interface.
Definition: interfaces.cpp:713
NodeContext struct containing references to chain state and connection state.
Definition: context.h:39
interfaces::Init * init
Init interface for initializing current process and connecting to other processes.
Definition: context.h:41
ArgsManager * args
Definition: context.h:49
ArgsManager gArgs
Definition: system.cpp:85