Bitcoin Core
31.0.0
P2P Digital Currency
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 <
init.h
>
6
#include <
interfaces/chain.h
>
7
#include <
interfaces/echo.h
>
8
#include <
interfaces/init.h
>
9
#include <
interfaces/ipc.h
>
10
#include <
interfaces/node.h
>
11
#include <
interfaces/wallet.h
>
12
#include <
node/context.h
>
13
#include <
util/check.h
>
14
15
#include <memory>
16
17
namespace
init
{
18
namespace
{
19
const
char
*
EXE_NAME
=
"bitcoin-gui"
;
20
21
class
BitcoinGuiInit :
public
interfaces::Init
22
{
23
public
:
24
BitcoinGuiInit(
const
char
*
arg0
) :
m_ipc
(
interfaces::MakeIpc
(
EXE_NAME
,
arg0
, *
this
))
25
{
26
InitContext
(
m_node
);
27
m_node
.
init
=
this
;
28
}
29
std::unique_ptr<interfaces::Node> makeNode()
override
{
return
interfaces::MakeNode
(
m_node
); }
30
std::unique_ptr<interfaces::Chain> makeChain()
override
{
return
interfaces::MakeChain
(
m_node
); }
31
std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(
interfaces::Chain
& chain)
override
32
{
33
return
MakeWalletLoader(chain, *
Assert
(
m_node
.
args
));
34
}
35
std::unique_ptr<interfaces::Echo> makeEcho()
override
{
return
interfaces::MakeEcho
(); }
36
interfaces::Ipc
*
ipc
()
override
{
return
m_ipc
.get(); }
37
// bitcoin-gui accepts -ipcbind option even though it does not use it
38
// directly. It just returns true here to accept the option because
39
// bitcoin-node accepts the option, and bitcoin-gui accepts all bitcoin-node
40
// options and will start the node with those options.
41
bool
canListenIpc()
override
{
return
true
; }
42
const
char
* exeName()
override
{
return
EXE_NAME
; }
43
node::NodeContext
m_node
;
44
std::unique_ptr<interfaces::Ipc>
m_ipc
;
45
};
46
}
// namespace
47
}
// namespace init
48
49
namespace
interfaces
{
50
std::unique_ptr<Init>
MakeGuiInit
(
int
argc
,
char
*
argv
[])
51
{
52
return
std::make_unique<init::BitcoinGuiInit>(
argc
> 0 ?
argv
[0] :
""
);
53
}
54
}
// namespace interfaces
m_ipc
std::unique_ptr< interfaces::Ipc > m_ipc
Definition
bitcoin-gui.cpp:44
m_node
node::NodeContext m_node
Definition
bitcoin-gui.cpp:43
check.h
Assert
#define Assert(val)
Identity function.
Definition
check.h:113
interfaces::Chain
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition
chain.h:118
interfaces::Init
Initial interface created when a process is first started, and used to give and get access to other i...
Definition
init.h:31
interfaces::Ipc
Interface providing access to interprocess-communication (IPC) functionality.
Definition
ipc.h:50
echo.h
InitContext
void InitContext(NodeContext &node)
Initialize node context shutdown and args variables.
Definition
init.cpp:213
chain.h
init.h
wallet.h
init.h
ipc.h
init
Definition
bitcoin-gui.cpp:17
interfaces
Definition
interfaces.cpp:41
interfaces::MakeNode
std::unique_ptr< Node > MakeNode(node::NodeContext &context)
Return implementation of Node interface.
Definition
interfaces.cpp:1022
interfaces::MakeEcho
std::unique_ptr< Echo > MakeEcho()
Return implementation of Echo interface.
Definition
interfaces.cpp:52
interfaces::MakeGuiInit
std::unique_ptr< Init > MakeGuiInit(int argc, char *argv[])
Return implementation of Init interface for the gui process.
Definition
bitcoin-gui.cpp:50
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:132
interfaces::MakeChain
std::unique_ptr< Chain > MakeChain(node::NodeContext &node)
Return implementation of Chain interface.
Definition
interfaces.cpp:1023
ipc
Definition
ipc.h:12
context.h
node.h
node::NodeContext
NodeContext struct containing references to chain state and connection state.
Definition
context.h:56
node::NodeContext::args
ArgsManager * args
Definition
context.h:74
node::NodeContext::init
interfaces::Init * init
Init interface for initializing current process and connecting to other processes.
Definition
context.h:61
Ticks
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition
time.h:73
Generated on Thu Apr 16 2026 09:42:38 for Bitcoin Core by
1.10.0