From 82cfb6f370651f5bd167bda0b932592489a30fee Mon Sep 17 00:00:00 2001 From: Simon Paitrault Date: Fri, 15 Dec 2023 16:54:03 +0100 Subject: [PATCH] chore: adding context to p2p msg received Signed-off-by: Simon Paitrault --- crates/topos-tce/src/app_context/network.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/crates/topos-tce/src/app_context/network.rs b/crates/topos-tce/src/app_context/network.rs index 9106cad59..f5c061227 100644 --- a/crates/topos-tce/src/app_context/network.rs +++ b/crates/topos-tce/src/app_context/network.rs @@ -6,7 +6,7 @@ use tokio::spawn; use topos_metrics::CERTIFICATE_DELIVERY_LATENCY; use topos_p2p::Event as NetEvent; use topos_tce_broadcast::DoubleEchoCommand; -use tracing::{error, info, trace}; +use tracing::{debug, error, info, trace}; use topos_core::api::grpc::tce::v1::{double_echo_request, DoubleEchoRequest, Echo, Gossip, Ready}; use topos_core::uci; @@ -21,7 +21,7 @@ impl AppContext { &evt ); - let NetEvent::Gossip { data, .. } = evt; + let NetEvent::Gossip { data, from } = evt; if let Ok(DoubleEchoRequest { request: Some(double_echo_request), }) = DoubleEchoRequest::decode(&data[..]) @@ -79,9 +79,16 @@ impl AppContext { ); e }); + if let (Ok(certificate_id), Ok(validator_id)) = (certificate_id, validator_id) { + debug!( + "Received Echo message, certificate_id: {certificate_id}, \ + validator_id: {validator_id} from {from}", + certificate_id = certificate_id, + validator_id = validator_id + ); if let Err(e) = channel .send(DoubleEchoCommand::Echo { signature: signature.into(), @@ -121,6 +128,12 @@ impl AppContext { if let (Ok(certificate_id), Ok(validator_id)) = (certificate_id, validator_id) { + debug!( + "Received Ready message, certificate_id: {certificate_id}, \ + validator_id: {validator_id} from {from}", + certificate_id = certificate_id, + validator_id = validator_id + ); if let Err(e) = channel .send(DoubleEchoCommand::Ready { signature: signature.into(),