Skip to content

Commit d510686

Browse files
Rename merkle to merkle_root.
1 parent cfce37b commit d510686

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

include/bitcoin/protocol/web/socket.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ class BCP_API socket
108108
void add_connection(connection_ptr connection);
109109
void remove_connection(connection_ptr connection);
110110
void notify_query_work(connection_ptr connection,
111-
const std::string& method, uint32_t id, const std::string& parameters,
112-
bool rpc);
111+
const std::string& method, uint32_t id, const std::string& parameters);
113112

114113
protected:
115114
// Initialize the websocket event loop and start a thread to poll events.

src/web/json_string.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ std::string to_json(const chain::header& header, uint32_t id)
146146
tree.put("hash", encode_hash(header.hash()));
147147
tree.put("version", header.version());
148148
tree.put("versionHex", hex(header.version()));
149-
tree.put("merkleroot", encode_hash(header.merkle()));
149+
tree.put("merkleroot", encode_hash(header.merkle_root()));
150150
tree.put("time", header.timestamp());
151151
tree.put("nonce", header.nonce());
152152
tree.put("bits", hex(header.bits()));

src/web/socket.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ bool socket::handle_event(connection_ptr connection, http_event event,
272272
<< "method " << method << ", parameters " << parameters
273273
<< ", id " << id;
274274

275-
instance->notify_query_work(connection, method, id, parameters, true);
275+
instance->notify_query_work(connection, method, id, parameters);
276276
break;
277277
}
278278

@@ -316,7 +316,7 @@ bool socket::handle_event(connection_ptr connection, http_event event,
316316
<< "method " << method << ", parameters " << parameters
317317
<< ", id " << id;
318318

319-
instance->notify_query_work(connection, method, id, parameters, false);
319+
instance->notify_query_work(connection, method, id, parameters);
320320
break;
321321
}
322322

@@ -565,14 +565,13 @@ void socket::remove_connection(connection_ptr connection)
565565
// Errors write directly on the connection since this is called from
566566
// the event_handler, which is called on the websocket thread.
567567
void socket::notify_query_work(connection_ptr connection,
568-
const std::string& method, uint32_t id, const std::string& parameters,
569-
bool rpc)
568+
const std::string& method, uint32_t id, const std::string& parameters)
570569
{
570+
const auto rpc = connection->json_rpc();
571571
const auto send_error_reply = [=](protocol_status status, const code& ec)
572572
{
573573
http_reply reply;
574-
const auto error = (connection->json_rpc() ? rpc::to_json(ec, id) :
575-
to_json(ec, id));
574+
const auto error = (rpc ? rpc::to_json(ec, id) : to_json(ec, id));
576575
const auto response = reply.generate(status, {}, error.size(), false);
577576
LOG_VERBOSE(LOG_PROTOCOL) << response + error;
578577
connection->write(response + error);

0 commit comments

Comments
 (0)