From 0f3aa728ecc527f8de4c3273ae0433d10fd9874b Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 4 Apr 2022 09:21:47 +0200 Subject: [PATCH 1/3] Fix milestone timestamp in API --- .../src/endpoints/routes/api/v1/milestone.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/bee-api/bee-rest-api/src/endpoints/routes/api/v1/milestone.rs b/bee-api/bee-rest-api/src/endpoints/routes/api/v1/milestone.rs index 686c29b775..6becc9bcf7 100644 --- a/bee-api/bee-rest-api/src/endpoints/routes/api/v1/milestone.rs +++ b/bee-api/bee-rest-api/src/endpoints/routes/api/v1/milestone.rs @@ -40,17 +40,12 @@ pub(crate) fn milestone( milestone_index: MilestoneIndex, tangle: ResourceHandle>, ) -> Result { - match tangle.get_milestone_message_id(milestone_index) { - Some(message_id) => match tangle.get_metadata(&message_id) { - Some(metadata) => Ok(warp::reply::json(&SuccessBody::new(MilestoneResponse { - milestone_index: *milestone_index, - message_id: message_id.to_string(), - timestamp: metadata.arrival_timestamp(), - }))), - None => Err(reject::custom(CustomRejection::NotFound( - "can not find metadata for milestone".to_string(), - ))), - }, + match tangle.get_milestone(milestone_index) { + Some(milestone) => Ok(warp::reply::json(&SuccessBody::new(MilestoneResponse { + milestone_index: *milestone_index, + message_id: milestone.message_id().to_string(), + timestamp: milestone.timestamp(), + }))), None => Err(reject::custom(CustomRejection::NotFound( "can not find milestone".to_string(), ))), From ad3596663ac15b864c8f927a9ab47da8f6399181 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 4 Apr 2022 09:23:06 +0200 Subject: [PATCH 2/3] Fmt --- .../bee-gossip/src/swarm/protocols/iota_gossip/handler.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bee-network/bee-gossip/src/swarm/protocols/iota_gossip/handler.rs b/bee-network/bee-gossip/src/swarm/protocols/iota_gossip/handler.rs index a6eb54b974..2ca6f03756 100644 --- a/bee-network/bee-gossip/src/swarm/protocols/iota_gossip/handler.rs +++ b/bee-network/bee-gossip/src/swarm/protocols/iota_gossip/handler.rs @@ -64,9 +64,9 @@ impl ProtocolsHandler for GossipProtocolHandler { /// substreams to negotiate the desired protocols. /// /// > **Note**: The returned `InboundUpgrade` should always accept all the generally - /// > supported protocols, even if in a specific context a particular one is - /// > not supported, (eg. when only allowing one substream at a time for a protocol). - /// > This allows a remote to put the list of supported protocols in a cache. + /// > supported protocols, even if in a specific context a particular one is + /// > not supported, (eg. when only allowing one substream at a time for a protocol). + /// > This allows a remote to put the list of supported protocols in a cache. fn listen_protocol(&self) -> SubstreamProtocol { debug!("gossip handler: responding to listen protocol request."); From eb391fe8ffd823be67b67bddda2578f818d68523 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 4 Apr 2022 10:00:28 +0200 Subject: [PATCH 3/3] Update bee-api/bee-rest-api/src/endpoints/routes/api/v1/milestone.rs Co-authored-by: /alex/ --- bee-api/bee-rest-api/src/endpoints/routes/api/v1/milestone.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bee-api/bee-rest-api/src/endpoints/routes/api/v1/milestone.rs b/bee-api/bee-rest-api/src/endpoints/routes/api/v1/milestone.rs index 6becc9bcf7..1fd051b423 100644 --- a/bee-api/bee-rest-api/src/endpoints/routes/api/v1/milestone.rs +++ b/bee-api/bee-rest-api/src/endpoints/routes/api/v1/milestone.rs @@ -47,7 +47,7 @@ pub(crate) fn milestone( timestamp: milestone.timestamp(), }))), None => Err(reject::custom(CustomRejection::NotFound( - "can not find milestone".to_string(), + "cannot find milestone".to_string(), ))), } }