X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Frouting%2Fgossip.rs;h=c15a7547b996e455bfc752b8befae2ab83b86c84;hb=0c250468d632ed6df93d8a9d34389a2cb61eac40;hp=64dbb45888b338177f54f662efc0647e620a7c49;hpb=8f024303e781be9c1379c8efdefdb669fadb6325;p=rust-lightning diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs index 64dbb458..c15a7547 100644 --- a/lightning/src/routing/gossip.rs +++ b/lightning/src/routing/gossip.rs @@ -88,12 +88,12 @@ impl NodeId { impl fmt::Debug for NodeId { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "NodeId({})", log_bytes!(self.0)) + write!(f, "NodeId({})", crate::util::logger::DebugBytes(&self.0)) } } impl fmt::Display for NodeId { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", log_bytes!(self.0)) + crate::util::logger::DebugBytes(&self.0).fmt(f) } } @@ -899,7 +899,7 @@ impl ChannelInfo { impl fmt::Display for ChannelInfo { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { write!(f, "features: {}, node_one: {}, one_to_two: {:?}, node_two: {}, two_to_one: {:?}", - log_bytes!(self.features.encode()), log_bytes!(self.node_one.as_slice()), self.one_to_two, log_bytes!(self.node_two.as_slice()), self.two_to_one)?; + log_bytes!(self.features.encode()), &self.node_one, self.one_to_two, &self.node_two, self.two_to_one)?; Ok(()) } } @@ -1350,7 +1350,7 @@ impl fmt::Display for NetworkGraph where L::Target: Logger { } writeln!(f, "[Nodes]")?; for (&node_id, val) in self.nodes.read().unwrap().unordered_iter() { - writeln!(f, " {}: {}", log_bytes!(node_id.as_slice()), val)?; + writeln!(f, " {}: {}", &node_id, val)?; } Ok(()) } @@ -3429,6 +3429,12 @@ pub(crate) mod tests { // This serialized info has an address field but no announcement_message, therefore the addresses returned by our function will still be empty assert!(ann_info_with_addresses.addresses().is_empty()); } + + #[test] + fn test_node_id_display() { + let node_id = NodeId([42; 33]); + assert_eq!(format!("{}", &node_id), "2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a"); + } } #[cfg(ldk_bench)]