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:
parent
628a597de5
commit
b3d4de8469
2 changed files with 3 additions and 0 deletions
|
|
@ -1079,6 +1079,7 @@ TEST (websocket, new_unconfirmed_block)
|
||||||
boost::property_tree::ptree event;
|
boost::property_tree::ptree event;
|
||||||
boost::property_tree::read_json (stream, event);
|
boost::property_tree::read_json (stream, event);
|
||||||
ASSERT_EQ (event.get<std::string> ("topic"), "new_unconfirmed_block");
|
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");
|
auto message_contents = event.get_child ("message");
|
||||||
ASSERT_EQ ("state", message_contents.get<std::string> ("type"));
|
ASSERT_EQ ("state", message_contents.get<std::string> ("type"));
|
||||||
|
|
|
||||||
|
|
@ -957,7 +957,9 @@ nano::websocket::message nano::websocket::message_builder::new_block_arrived (na
|
||||||
auto subtype (nano::state_subtype (block_a.sideband ().details));
|
auto subtype (nano::state_subtype (block_a.sideband ().details));
|
||||||
block_l.put ("subtype", subtype);
|
block_l.put ("subtype", subtype);
|
||||||
|
|
||||||
|
message_l.contents.put ("hash", block_a.hash ().to_string ());
|
||||||
message_l.contents.add_child ("message", block_l);
|
message_l.contents.add_child ("message", block_l);
|
||||||
|
|
||||||
return message_l;
|
return message_l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue