From d5f985e51f2863fda0c0d632e836eba42a5c3e15 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 5 Dec 2017 15:57:12 -0500 Subject: multiprocess: Add new bitcoin-gui, bitcoin-qt, bitcoin-wallet init implementations Add separate init implementations instead of sharing existing bitcoind and bitcoin-node ones, so they can start to be differentiated in upcoming commits with node and wallet code no longer linked into the bitcoin-gui binary and wallet code no longer linked into the bitcoin-node binary. --- src/init/bitcoin-gui.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/init/bitcoin-gui.cpp (limited to 'src/init/bitcoin-gui.cpp') diff --git a/src/init/bitcoin-gui.cpp b/src/init/bitcoin-gui.cpp new file mode 100644 index 0000000000..c549ed3cc0 --- /dev/null +++ b/src/init/bitcoin-gui.cpp @@ -0,0 +1,47 @@ +// Copyright (c) 2021 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace init { +namespace { +const char* EXE_NAME = "bitcoin-gui"; + +class BitcoinGuiInit : public interfaces::Init +{ +public: + BitcoinGuiInit(const char* arg0) : m_ipc(interfaces::MakeIpc(EXE_NAME, arg0, *this)) + { + m_node.args = &gArgs; + m_node.init = this; + } + std::unique_ptr makeNode() override { return interfaces::MakeNode(m_node); } + std::unique_ptr makeChain() override { return interfaces::MakeChain(m_node); } + std::unique_ptr makeWalletClient(interfaces::Chain& chain) override + { + return MakeWalletClient(chain, *Assert(m_node.args)); + } + std::unique_ptr makeEcho() override { return interfaces::MakeEcho(); } + interfaces::Ipc* ipc() override { return m_ipc.get(); } + NodeContext m_node; + std::unique_ptr m_ipc; +}; +} // namespace +} // namespace init + +namespace interfaces { +std::unique_ptr MakeGuiInit(int argc, char* argv[]) +{ + return std::make_unique(argc > 0 ? argv[0] : ""); +} +} // namespace interfaces -- cgit v1.2.3