mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-04 18:13:33 +02:00
lnwire+multi: define Error() for lnwire.Error
To make lnwire.Error actually satisfy the error interface, define the Error method directly.
This commit is contained in:
@@ -1882,13 +1882,9 @@ func (l *channelLink) handleUpstreamMsg(msg lnwire.Message) {
|
||||
// Error received from remote, MUST fail channel, but should
|
||||
// only print the contents of the error message if all
|
||||
// characters are printable ASCII.
|
||||
errMsg := "non-ascii data"
|
||||
if isASCII(msg.Data) {
|
||||
errMsg = string(msg.Data)
|
||||
}
|
||||
l.fail(LinkFailureError{code: ErrRemoteError},
|
||||
"ChannelPoint(%v): received error from peer: %v",
|
||||
l.channel.ChannelPoint(), errMsg)
|
||||
l.channel.ChannelPoint(), msg.Error())
|
||||
default:
|
||||
log.Warnf("ChannelPoint(%v): received unknown message of type %T",
|
||||
l.channel.ChannelPoint(), msg)
|
||||
@@ -3100,16 +3096,3 @@ func (l *channelLink) tracef(format string, a ...interface{}) {
|
||||
msg := fmt.Sprintf(format, a...)
|
||||
log.Tracef("ChannelLink(%s) %s", l.ShortChanID(), msg)
|
||||
}
|
||||
|
||||
// isASCII is a helper method that checks whether all bytes in `data` would be
|
||||
// printable ASCII characters if interpreted as a string.
|
||||
func isASCII(data []byte) bool {
|
||||
isASCII := true
|
||||
for _, c := range data {
|
||||
if c < 32 || c > 126 {
|
||||
isASCII = false
|
||||
break
|
||||
}
|
||||
}
|
||||
return isASCII
|
||||
}
|
||||
|
Reference in New Issue
Block a user