Skip to content

Commit

Permalink
chore: change NodeIdentity debug (#3817)
Browse files Browse the repository at this point in the history
Description
---
Remove secret_key from debug print for `NodeIdentity`. The display is using the same fields that are used in the `fmt::Display` trait
  • Loading branch information
Cifko committed Feb 15, 2022
1 parent 5cda980 commit a71645d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion comms/src/peer_manager/node_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use crate::{
};

/// The public and private identity of this node on the network
#[derive(Debug, Serialize, Deserialize)]
#[derive(Serialize, Deserialize)]
pub struct NodeIdentity {
#[serde(serialize_with = "serialize_to_hex")]
#[serde(deserialize_with = "deserialize_node_id_from_hex")]
Expand Down Expand Up @@ -221,3 +221,16 @@ impl fmt::Display for NodeIdentity {
Ok(())
}
}

impl fmt::Debug for NodeIdentity {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("NodeIdentity")
.field("public_key", &self.public_key)
.field("node_id", &self.node_id)
.field("public_address", &self.public_address)
.field("features", &self.features)
.field("secret_key", &"<secret>")
.field("identity_signature", &*acquire_read_lock!(self.identity_signature))
.finish()
}
}

0 comments on commit a71645d

Please sign in to comment.