Skip to content

Commit b845717

Browse files
committed
Use NodeId Display in logging instead of log_bytes, improve it.
1 parent 69c9a34 commit b845717

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lightning/src/routing/gossip.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use bitcoin::secp256k1;
1616

1717
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
1818
use bitcoin::hashes::Hash;
19-
use bitcoin::hashes::hex::FromHex;
19+
use bitcoin::hashes::hex::{FromHex, ToHex};
2020
use bitcoin::hash_types::BlockHash;
2121

2222
use bitcoin::network::constants::Network;
@@ -88,12 +88,12 @@ impl NodeId {
8888

8989
impl fmt::Debug for NodeId {
9090
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
91-
write!(f, "NodeId({})", log_bytes!(self.0))
91+
write!(f, "NodeId({})", self.0.to_hex())
9292
}
9393
}
9494
impl fmt::Display for NodeId {
9595
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
96-
write!(f, "{}", log_bytes!(self.0))
96+
write!(f, "{}", self.0.to_hex())
9797
}
9898
}
9999

@@ -899,7 +899,7 @@ impl ChannelInfo {
899899
impl fmt::Display for ChannelInfo {
900900
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
901901
write!(f, "features: {}, node_one: {}, one_to_two: {:?}, node_two: {}, two_to_one: {:?}",
902-
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)?;
902+
log_bytes!(self.features.encode()), &self.node_one, self.one_to_two, &self.node_two, self.two_to_one)?;
903903
Ok(())
904904
}
905905
}
@@ -1350,7 +1350,7 @@ impl<L: Deref> fmt::Display for NetworkGraph<L> where L::Target: Logger {
13501350
}
13511351
writeln!(f, "[Nodes]")?;
13521352
for (&node_id, val) in self.nodes.read().unwrap().unordered_iter() {
1353-
writeln!(f, " {}: {}", log_bytes!(node_id.as_slice()), val)?;
1353+
writeln!(f, " {}: {}", &node_id, val)?;
13541354
}
13551355
Ok(())
13561356
}

0 commit comments

Comments
 (0)