From 41358535a084ecaab222621589967b3ac81fa23b Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Thu, 22 Jun 2023 11:40:17 +0200 Subject: [PATCH] fix mqtt milestone --- sdk/src/client/node_api/mqtt/mod.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sdk/src/client/node_api/mqtt/mod.rs b/sdk/src/client/node_api/mqtt/mod.rs index 429c44d2a5..df7d374573 100644 --- a/sdk/src/client/node_api/mqtt/mod.rs +++ b/sdk/src/client/node_api/mqtt/mod.rs @@ -18,7 +18,7 @@ pub use self::{error::Error, types::*}; use crate::{ client::{Client, ClientInner}, types::block::{ - payload::{milestone::ReceiptMilestoneOption, MilestonePayload}, + payload::{milestone::ReceiptMilestoneOption, Payload}, Block, }, }; @@ -206,11 +206,18 @@ fn poll_mqtt(client: &Client, mut event_loop: EventLoop) { let payload = &*p.payload; let protocol_parameters = &client.network_info.read().await.protocol_parameters; - match MilestonePayload::unpack_verified(payload, protocol_parameters) { - Ok(milestone_payload) => Ok(TopicEvent { + match Payload::unpack_verified(payload, protocol_parameters) { + Ok(Payload::Milestone(milestone)) => Ok(TopicEvent { topic: p.topic.clone(), - payload: MqttPayload::MilestonePayload(milestone_payload), + payload: MqttPayload::MilestonePayload(*milestone), }), + Ok(p) => { + warn!( + "'milestone' topic returned non-milestone payload, kind: {:?}", + p.kind() + ); + Err(()) + } Err(e) => { warn!("MilestonePayload unpacking failed: {:?}", e); Err(())