diff --git a/src/DotNetLightning.Core/Serialize/Msgs/Msgs.fs b/src/DotNetLightning.Core/Serialize/Msgs/Msgs.fs index 542b4d9c6..020f13ebe 100644 --- a/src/DotNetLightning.Core/Serialize/Msgs/Msgs.fs +++ b/src/DotNetLightning.Core/Serialize/Msgs/Msgs.fs @@ -1288,7 +1288,15 @@ type ErrorMessage = ls.WriteWithLen(this.Data) member this.GetFailureMsgData() = - System.Text.ASCIIEncoding.ASCII.GetString(this.Data) + let isPrintableAscii = + not <| Array.exists (fun asciiByte -> asciiByte < 32uy) this.Data + if isPrintableAscii then + System.Text.ASCIIEncoding.ASCII.GetString(this.Data) + else + Array.fold + (fun msg (asciiByte: byte) -> sprintf "%s %02x" msg asciiByte) + ":" + this.Data and WhichChannel = | SpecificChannel of ChannelId