Skip to content

Commit

Permalink
node, node-data: changed warn and error log messages to avoid outputt…
Browse files Browse the repository at this point in the history
…ing unneeded information
  • Loading branch information
d-sonuga committed Nov 20, 2024
1 parent e98c343 commit 3e1c49b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion node-data/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
Expand Down Expand Up @@ -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<payload::Ratification> for Payload {
Expand Down
2 changes: 1 addition & 1 deletion node/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl<const N: usize> crate::Network for Kadcast<N> {

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}")
})?;

Expand Down

0 comments on commit 3e1c49b

Please sign in to comment.