mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-12 07:39:41 +02:00
ipc: Expose an RPC interface over the -ipcbind socket
This allows `bitcoin-cli` to connect to the node via IPC instead TCP to execute RPC methods in an upcoming commit.
This commit is contained in:
@@ -16,4 +16,6 @@ The following interfaces are defined here:
|
||||
|
||||
* [`Ipc`](ipc.h) — used by multiprocess code to access `Init` interface across processes. Added in [#19160](https://github.com/bitcoin/bitcoin/pull/19160).
|
||||
|
||||
* [`Rpc`](rpc.h) — used by `bitcoin-cli` to be able to call RPC methods over a unix socket instead of TCP.
|
||||
|
||||
The interfaces above define boundaries between major components of bitcoin code (node, wallet, and gui), making it possible for them to run in [different processes](../../doc/multiprocess.md), and be tested, developed, and understood independently. These interfaces are not currently designed to be stable or to be used externally.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <interfaces/echo.h>
|
||||
#include <interfaces/mining.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <interfaces/rpc.h>
|
||||
#include <interfaces/wallet.h>
|
||||
|
||||
#include <memory>
|
||||
@@ -36,6 +37,7 @@ public:
|
||||
virtual std::unique_ptr<Mining> makeMining() { return nullptr; }
|
||||
virtual std::unique_ptr<WalletLoader> makeWalletLoader(Chain& chain) { return nullptr; }
|
||||
virtual std::unique_ptr<Echo> makeEcho() { return nullptr; }
|
||||
virtual std::unique_ptr<Rpc> makeRpc() { return nullptr; }
|
||||
virtual Ipc* ipc() { return nullptr; }
|
||||
virtual bool canListenIpc() { return false; }
|
||||
virtual const char* exeName() { return nullptr; }
|
||||
|
||||
31
src/interfaces/rpc.h
Normal file
31
src/interfaces/rpc.h
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2025 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_INTERFACES_RPC_H
|
||||
#define BITCOIN_INTERFACES_RPC_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
class UniValue;
|
||||
|
||||
namespace node {
|
||||
struct NodeContext;
|
||||
} // namespace node
|
||||
|
||||
namespace interfaces {
|
||||
//! Interface giving clients ability to emulate HTTP RPC calls.
|
||||
class Rpc
|
||||
{
|
||||
public:
|
||||
virtual ~Rpc() = default;
|
||||
virtual UniValue executeRpc(UniValue request, std::string url, std::string user) = 0;
|
||||
};
|
||||
|
||||
//! Return implementation of Rpc interface.
|
||||
std::unique_ptr<Rpc> MakeRpc(node::NodeContext& node);
|
||||
|
||||
} // namespace interfaces
|
||||
|
||||
#endif // BITCOIN_INTERFACES_RPC_H
|
||||
Reference in New Issue
Block a user