Add block_hash to websocket response for new_unconfirmed_block (#4729)

Co-authored-by: gr0vity-dev <homebot@users.noreply.github.com>
This commit is contained in:
gr0vity-dev 2024-09-12 12:23:48 +02:00 committed by GitHub
commit b3d4de8469
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View file

@ -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"));

View file

@ -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;
}