From 64000f76cd7cd5bdb6b252d3ab0ec291a83da17a Mon Sep 17 00:00:00 2001 From: gr0vity-dev <homebot@users.noreply.github.com> Date: Wed, 11 Sep 2024 21:25:38 +0200 Subject: [PATCH] Add block_hash to websocket response for new_unconfirmed_block --- nano/core_test/websocket.cpp | 1 + nano/node/websocket.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/nano/core_test/websocket.cpp b/nano/core_test/websocket.cpp index f62c2e9682..102c22430c 100644 --- a/nano/core_test/websocket.cpp +++ b/nano/core_test/websocket.cpp @@ -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")); diff --git a/nano/node/websocket.cpp b/nano/node/websocket.cpp index 698f0075e0..76d19aa80d 100644 --- a/nano/node/websocket.cpp +++ b/nano/node/websocket.cpp @@ -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; }