aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/misc.cpp
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-09-16 08:23:04 +0800
committerfanquake <fanquake@gmail.com>2021-09-16 08:47:38 +0800
commit528e08119fd837dfe73d80d0064409ac03b3bfee (patch)
tree1fc7829920298294639b0375f3ce36c7bab5591c /src/rpc/misc.cpp
parent2161a058552ac938f2079b311a2d12f5d1772d01 (diff)
parente4709c7b56612553fb7cbf16ef2d5099c5b732d0 (diff)
Merge bitcoin/bitcoin#22219: multiprocess: Start using init makeNode, makeChain, etc methods
e4709c7b56612553fb7cbf16ef2d5099c5b732d0 Start using init makeNode, makeChain, etc methods (Russell Yanofsky) Pull request description: Use `interfaces::Init::make*` methods instead of `interfaces::Make*` functions, so interfaces can be constructed differently in different executable without having to change any code. (So for example `bitcoin-gui` can make an `interfaces::Node` pointer that communicates with a `bitcoin-node` subprocess, while `bitcoin-qt` can make an `interfaces::Node` pointer that controls node code in the same process.) --- This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10). The commit was first part of larger PR #10102. ACKs for top commit: jamesob: reACK https://github.com/bitcoin/bitcoin/commit/e4709c7b56612553fb7cbf16ef2d5099c5b732d0 achow101: ACK e4709c7b56612553fb7cbf16ef2d5099c5b732d0 benthecarman: utACK e4709c7b56612553fb7cbf16ef2d5099c5b732d0 Tree-SHA512: 580c1979dbb2ef444157c8e53041e70d15ddeee77e5cbdb34f70b6d228cc2d2fe3843825f172da84e506200c58f7e0932f7cd4c006bb5058c1f4e43259394834
Diffstat (limited to 'src/rpc/misc.cpp')
-rw-r--r--src/rpc/misc.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp
index e5804211f3..14b0e5a984 100644
--- a/src/rpc/misc.cpp
+++ b/src/rpc/misc.cpp
@@ -670,8 +670,9 @@ static RPCHelpMan echoipc()
RPCExamples{HelpExampleCli("echo", "\"Hello world\"") +
HelpExampleRpc("echo", "\"Hello world\"")},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue {
+ interfaces::Init& local_init = *EnsureAnyNodeContext(request.context).init;
std::unique_ptr<interfaces::Echo> echo;
- if (interfaces::Ipc* ipc = Assert(EnsureAnyNodeContext(request.context).init)->ipc()) {
+ if (interfaces::Ipc* ipc = local_init.ipc()) {
// Spawn a new bitcoin-node process and call makeEcho to get a
// client pointer to a interfaces::Echo instance running in
// that process. This is just for testing. A slightly more
@@ -689,7 +690,7 @@ static RPCHelpMan echoipc()
// interfaces::Echo object and return it so the `echoipc` RPC
// method will work, and the python test calling `echoipc`
// can expect the same result.
- echo = interfaces::MakeEcho();
+ echo = local_init.makeEcho();
}
return echo->echo(request.params[0].get_str());
},