Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions src/protocols/protocol_bitcoind_rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace node {
using namespace system;
using namespace network::rpc;
using namespace network::http;
using namespace network::monad;
using namespace std::placeholders;
using namespace boost::json;

Expand Down Expand Up @@ -130,32 +131,17 @@ void protocol_bitcoind_rpc::handle_receive_post(const code& ec,
}

const auto& body = post->body();
if (!body.contains<json_body::value_type>())
if (!body.contains<rpcin_value>())
{
send_not_acceptable(*post);
return;
}

request_t request{};
try
{
request = value_to<request_t>(body.get<json_body::value_type>().model);
}
catch (const boost::system::system_error& e)
{
send_bad_target(e.code(), *post);
return;
}
catch (...)
{
send_bad_target(error::unexpected_parse, *post);
return;
}

// The post is saved off during asynchonous handling and used in send_json
// to formulate response headers, isolating handlers from http semantics.
set_request(post);

const auto& request = body.get<rpcin_value>().message;
if (const auto code = rpc_dispatcher_.notify(request))
stop(code);
}
Expand Down
Loading