Skip to content

Commit 9b9f545

Browse files
authored
Merge pull request #936 from evoskuil/master
Read pcin_value from bitcoind.rpc message.
2 parents 23f2628 + 6cafb1c commit 9b9f545

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

src/protocols/protocol_bitcoind_rpc.cpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace node {
3131
using namespace system;
3232
using namespace network::rpc;
3333
using namespace network::http;
34+
using namespace network::monad;
3435
using namespace std::placeholders;
3536
using namespace boost::json;
3637

@@ -130,32 +131,17 @@ void protocol_bitcoind_rpc::handle_receive_post(const code& ec,
130131
}
131132

132133
const auto& body = post->body();
133-
if (!body.contains<json_body::value_type>())
134+
if (!body.contains<rpcin_value>())
134135
{
135136
send_not_acceptable(*post);
136137
return;
137138
}
138139

139-
request_t request{};
140-
try
141-
{
142-
request = value_to<request_t>(body.get<json_body::value_type>().model);
143-
}
144-
catch (const boost::system::system_error& e)
145-
{
146-
send_bad_target(e.code(), *post);
147-
return;
148-
}
149-
catch (...)
150-
{
151-
send_bad_target(error::unexpected_parse, *post);
152-
return;
153-
}
154-
155140
// The post is saved off during asynchonous handling and used in send_json
156141
// to formulate response headers, isolating handlers from http semantics.
157142
set_request(post);
158143

144+
const auto& request = body.get<rpcin_value>().message;
159145
if (const auto code = rpc_dispatcher_.notify(request))
160146
stop(code);
161147
}

0 commit comments

Comments
 (0)