Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
chore: adding context to p2p msg received
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
  • Loading branch information
Freyskeyd committed Dec 15, 2023
1 parent ffae4c6 commit 82cfb6f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions crates/topos-tce/src/app_context/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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[..])
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 82cfb6f

Please sign in to comment.