Ascii-fy the command string in message header trace

This commit is contained in:
Henry de Valence 2019-10-17 09:44:11 -07:00 committed by Deirdre Connolly
parent 17b93523bd
commit 0a56830eab
1 changed files with 8 additions and 1 deletions

View File

@ -334,7 +334,14 @@ impl Decoder for Codec {
let command = header_reader.read_12_bytes()?;
let body_len = header_reader.read_u32::<LittleEndian>()? as usize;
let checksum = Sha256dChecksum(header_reader.read_4_bytes()?);
trace!(?self.state, ?magic, ?command, body_len, ?checksum, "read header from src buffer");
trace!(
?self.state,
?magic,
command = %String::from_utf8_lossy(&command),
body_len,
?checksum,
"read header from src buffer"
);
if magic != self.builder.network.magic() {
return Err(Parse("supplied magic did not meet expectations"));