Skip to content

Commit

Permalink
Add block_hash to websocket response for new_unconfirmed_block
Browse files Browse the repository at this point in the history
  • Loading branch information
gr0vity-dev committed Sep 11, 2024
1 parent 628a597 commit 64000f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions nano/core_test/websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@ TEST (websocket, new_unconfirmed_block)
boost::property_tree::ptree event;
boost::property_tree::read_json (stream, event);
ASSERT_EQ (event.get<std::string> ("topic"), "new_unconfirmed_block");
ASSERT_EQ (event.get<std::string> ("hash"), send1->hash ().to_string ());

auto message_contents = event.get_child ("message");
ASSERT_EQ ("state", message_contents.get<std::string> ("type"));
Expand Down
2 changes: 2 additions & 0 deletions nano/node/websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,9 @@ nano::websocket::message nano::websocket::message_builder::new_block_arrived (na
auto subtype (nano::state_subtype (block_a.sideband ().details));
block_l.put ("subtype", subtype);

message_l.contents.put ("hash", block_a.hash ().to_string ());
message_l.contents.add_child ("message", block_l);

return message_l;
}

Expand Down

0 comments on commit 64000f7

Please sign in to comment.