LCOV - code coverage report
Current view: top level - src/interfaces - init.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 1 1 100.0 %
Date: 2026-06-25 07:23:43 Functions: 5 5 100.0 %

          Line data    Source code
       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             : #ifndef BITCOIN_INTERFACES_INIT_H
       6             : #define BITCOIN_INTERFACES_INIT_H
       7             : 
       8             : #include <memory>
       9             : 
      10             : namespace node {
      11             : struct NodeContext;
      12             : } // namespace node
      13             : 
      14             : namespace interfaces {
      15             : class Chain;
      16             : class Echo;
      17             : class Ipc;
      18             : class Node;
      19             : class WalletLoader;
      20             : namespace CoinJoin {
      21             : class Loader;
      22             : } // namespace CoinJoin
      23             : 
      24             : //! Initial interface created when a process is first started, and used to give
      25             : //! and get access to other interfaces (Node, Chain, Wallet, etc).
      26             : //!
      27             : //! There is a different Init interface implementation for each process
      28             : //! (bitcoin-gui, bitcoin-node, bitcoin-wallet, bitcoind, bitcoin-qt) and each
      29             : //! implementation can implement the make methods for interfaces it supports.
      30             : //! The default make methods all return null.
      31             : class Init
      32             : {
      33             : public:
      34        3570 :     virtual ~Init() = default;
      35             :     virtual std::unique_ptr<Node> makeNode();
      36             :     virtual std::unique_ptr<Chain> makeChain();
      37             :     virtual std::unique_ptr<CoinJoin::Loader> makeCoinJoinLoader();
      38             :     virtual std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain&, CoinJoin::Loader&);
      39             :     virtual std::unique_ptr<Echo> makeEcho();
      40             :     virtual Ipc* ipc();
      41             : };
      42             : 
      43             : //! Return implementation of Init interface for the node process. If the argv
      44             : //! indicates that this is a child process spawned to handle requests from a
      45             : //! parent process, this blocks and handles requests, then returns null and a
      46             : //! status code to exit with. If this returns non-null, the caller can start up
      47             : //! normally and use the Init object to spawn and connect to other processes
      48             : //! while it is running.
      49             : std::unique_ptr<Init> MakeNodeInit(node::NodeContext& node, int argc, char* argv[], int& exit_status);
      50             : 
      51             : //! Return implementation of Init interface for the wallet process.
      52             : std::unique_ptr<Init> MakeWalletInit(int argc, char* argv[], int& exit_status);
      53             : 
      54             : //! Return implementation of Init interface for the gui process.
      55             : std::unique_ptr<Init> MakeGuiInit(int argc, char* argv[]);
      56             : } // namespace interfaces
      57             : 
      58             : #endif // BITCOIN_INTERFACES_INIT_H

Generated by: LCOV version 1.16