mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 14:40:51 +02:00
htlcswitch: do not consider unknown failures an error
This commit is contained in:
@@ -31,10 +31,10 @@ type ForwardingError struct {
|
||||
// returned.
|
||||
func (f *ForwardingError) Error() string {
|
||||
if f.ExtraMsg == "" {
|
||||
return f.FailureMessage.Error()
|
||||
return fmt.Sprintf("%v", f.FailureMessage)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%v: %v", f.FailureMessage.Error(), f.ExtraMsg)
|
||||
return fmt.Sprintf("%v: %v", f.FailureMessage, f.ExtraMsg)
|
||||
}
|
||||
|
||||
// ErrorDecrypter is an interface that is used to decrypt the onion encrypted
|
||||
@@ -274,10 +274,14 @@ func (s *SphinxErrorDecrypter) DecryptError(reason lnwire.OpaqueReason) (
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Decode the failure. If an error occurs, we leave the failure message
|
||||
// field nil.
|
||||
r := bytes.NewReader(failure.Message)
|
||||
failureMsg, err := lnwire.DecodeFailure(r, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return &ForwardingError{
|
||||
FailureSourceIdx: failure.SenderIdx,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return &ForwardingError{
|
||||
|
Reference in New Issue
Block a user