Skip to content

Commit ba58a29

Browse files
committed
fix: replace to_hex with hex::encode
1 parent 2a39876 commit ba58a29

2 files changed

Lines changed: 2 additions & 9 deletions

File tree

crates/peerinfo/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ vise.workspace = true
2121
charon-core.workspace = true
2222
charon-p2p.workspace = true
2323
parking_lot.workspace = true
24+
hex.workspace = true
2425

2526
[build-dependencies]
2627
charon-build-proto.workspace = true
@@ -30,7 +31,6 @@ anyhow.workspace = true
3031
clap.workspace = true
3132
tokio.workspace = true
3233
tracing-subscriber.workspace = true
33-
hex.workspace = true
3434
vise-exporter.workspace = true
3535

3636
[lints]

crates/peerinfo/src/protocol.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,6 @@ fn supported_peer_version(version: &str, supported: &[SemVer]) -> Result<(), Pro
132132
})
133133
}
134134

135-
fn format_hex(data: &[u8]) -> String {
136-
data.iter()
137-
.map(|b| format!("{:02x}", b))
138-
.collect::<Vec<String>>()
139-
.join("")
140-
}
141-
142135
impl ProtocolState {
143136
/// Creates a new protocol state.
144137
pub fn new(peer_id: PeerId, local_info: LocalPeerInfo) -> Self {
@@ -228,7 +221,7 @@ impl ProtocolState {
228221
if peer_info.lock_hash != self.local_info.lock_hash {
229222
warn!(
230223
peer = self.name,
231-
lock_hash = format_hex(&peer_info.lock_hash),
224+
lock_hash = hex::encode(&peer_info.lock_hash),
232225
"Mismatching peer lock hash"
233226
);
234227
}

0 commit comments

Comments
 (0)