Bitcoin Core
32.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
init
bitcoin-gui.cpp
Go to the documentation of this file.
1
// Copyright (c) 2021-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
#include <
interfaces/init.h
>
// IWYU pragma: associated
6
7
#include <
init.h
>
8
#include <
interfaces/chain.h
>
9
#include <
interfaces/echo.h
>
10
#include <
interfaces/ipc.h
>
11
#include <
interfaces/mining.h
>
12
#include <
interfaces/node.h
>
13
#include <
interfaces/rpc.h
>
14
#include <
interfaces/wallet.h
>
15
#include <
node/context.h
>
16
#include <
util/check.h
>
17
18
#include <memory>
19
20
namespace
init
{
21
namespace
{
22
const
char
* EXE_NAME =
"bitcoin-gui"
;
23
24
class
BitcoinGuiInit :
public
interfaces::Init
25
{
26
public
:
27
BitcoinGuiInit(
const
char
* arg0) : m_ipc(interfaces::
MakeIpc
(EXE_NAME, arg0, *this))
28
{
29
InitContext
(m_node);
30
m_node.init =
this
;
31
}
32
std::unique_ptr<interfaces::Node> makeNode()
override
{
return
interfaces::MakeNode
(m_node); }
33
std::unique_ptr<interfaces::Chain> makeChain()
override
{
return
interfaces::MakeChain
(m_node); }
34
std::unique_ptr<interfaces::Mining> makeMining()
override
{
return
interfaces::MakeMining
(m_node); }
35
std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain& chain)
override
36
{
37
return
MakeWalletLoader
(chain, *
Assert
(m_node.args));
38
}
39
std::unique_ptr<interfaces::Echo> makeEcho()
override
{
return
interfaces::MakeEcho
(); }
40
std::unique_ptr<interfaces::Rpc> makeRpc()
override
{
return
interfaces::MakeRpc
(m_node); }
41
interfaces::Ipc* ipc()
override
{
return
m_ipc.get(); }
42
// bitcoin-gui accepts -ipcbind option even though it does not use it
43
// directly. It just returns true here to accept the option because
44
// bitcoin-node accepts the option, and bitcoin-gui accepts all bitcoin-node
45
// options and will start the node with those options.
46
bool
canListenIpc()
override
{
return
true
; }
47
const
char
* exeName()
override
{
return
EXE_NAME; }
48
node::NodeContext m_node;
49
std::unique_ptr<interfaces::Ipc> m_ipc;
50
};
51
}
// namespace
52
}
// namespace init
53
54
namespace
interfaces
{
55
std::unique_ptr<Init>
MakeGuiInit
(
int
argc,
char
* argv[])
56
{
57
return
std::make_unique<init::BitcoinGuiInit>(argc > 0 ? argv[0] :
""
);
58
}
59
}
// namespace interfaces
check.h
Assert
#define Assert(val)
Identity function.
Definition
check.h:116
echo.h
InitContext
void InitContext(NodeContext &node)
Initialize node context shutdown and args variables.
Definition
init.cpp:232
chain.h
init.h
mining.h
wallet.h
init.h
ipc.h
init
Definition
basic.cpp:11
interfaces
Definition
interfaces.cpp:42
interfaces::MakeNode
std::unique_ptr< Node > MakeNode(node::NodeContext &context)
Return implementation of Node interface.
Definition
interfaces.cpp:1087
interfaces::MakeEcho
std::unique_ptr< Echo > MakeEcho()
Return implementation of Echo interface.
Definition
interfaces.cpp:53
interfaces::MakeRpc
std::unique_ptr< Rpc > MakeRpc(node::NodeContext &node)
Return implementation of Rpc interface.
Definition
interfaces.cpp:1102
interfaces::MakeWalletLoader
std::unique_ptr< WalletLoader > MakeWalletLoader(Chain &chain, ArgsManager &args)
Definition
dummywallet.cpp:59
interfaces::MakeGuiInit
std::unique_ptr< Init > MakeGuiInit(int argc, char *argv[])
Return implementation of Init interface for the gui process.
Definition
bitcoin-gui.cpp:55
interfaces::MakeIpc
std::unique_ptr< Ipc > MakeIpc(const char *exe_name, const char *process_argv0, Init &init)
Return implementation of Ipc interface.
Definition
interfaces.cpp:137
interfaces::MakeMining
std::unique_ptr< Mining > MakeMining(const node::NodeContext &node, bool wait_loaded=true)
Definition
interfaces.cpp:1089
interfaces::MakeChain
std::unique_ptr< Chain > MakeChain(node::NodeContext &node)
Return implementation of Chain interface.
Definition
interfaces.cpp:1088
context.h
node.h
rpc.h
Generated on
for Bitcoin Core by
1.18.0