From 3e1c49b1d938343b21ab53856847d6e11d3257e6 Mon Sep 17 00:00:00 2001 From: Demilade Sonuga Date: Wed, 20 Nov 2024 14:58:06 +0100 Subject: [PATCH] node, node-data: changed warn and error log messages to avoid outputting unneeded information --- node-data/src/message.rs | 20 +++++++++++++++++++- node/src/network.rs | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/node-data/src/message.rs b/node-data/src/message.rs index 09b3216236..d9ec3ad202 100644 --- a/node-data/src/message.rs +++ b/node-data/src/message.rs @@ -129,7 +129,7 @@ impl Message { Payload::Validation(v) => v.sign_info().signer, Payload::Ratification(r) => r.sign_info().signer, msg => { - warn!("Calling get_signer for {msg:?}"); + warn!("Calling get_signer for payload: {:?}", msg.variant_name()); return None; } }; @@ -439,6 +439,24 @@ impl Payload { _ => {} } } + + fn variant_name(&self) -> &'static str { + match self { + Payload::Block(_) => "Block", + Payload::Candidate(_) => "Candidate", + Payload::Empty => "Empty", + Payload::GetBlocks(_) => "GetBlocks", + Payload::GetMempool(_) => "GetMempool", + Payload::GetResource(_) => "GetResource", + Payload::Inv(_) => "Inv", + Payload::Quorum(_) => "Quorum", + Payload::Ratification(_) => "Ratification", + Payload::Transaction(_) => "Transaction", + Payload::Validation(_) => "Validation", + Payload::ValidationQuorum(_) => "ValidationQuorum", + Payload::ValidationResult(_) => "ValidationResult", + } + } } impl From for Payload { diff --git a/node/src/network.rs b/node/src/network.rs index 4af87e0ef4..03e7a46c59 100644 --- a/node/src/network.rs +++ b/node/src/network.rs @@ -212,7 +212,7 @@ impl crate::Network for Kadcast { let mut encoded = vec![]; msg.write(&mut encoded).map_err(|err| { - error!("could not encode message {msg:?}: {err}"); + error!("could not encode message (version: {:?}, topics: {:?}, header: {:?}): {err}", msg.version(), msg.topic(), msg.header); anyhow::anyhow!("failed to broadcast: {err}") })?;