htlcswitch: remove extramsg string from ForwardingError
Remove the extramsg field in ForwardingError because it has been replaced with detailed link errors.
This commit is contained in:
parent
f430fd50c5
commit
ec099bf5dd
@ -88,10 +88,6 @@ type ForwardingError struct {
|
||||
// zero is the self node.
|
||||
FailureSourceIdx int
|
||||
|
||||
// ExtraMsg is an additional error message that callers can provide in
|
||||
// order to provide context specific error details.
|
||||
ExtraMsg string
|
||||
|
||||
// msg is the wire message associated with the error. This value may
|
||||
// be nil in the case where we fail to decode failure message sent by
|
||||
// a peer.
|
||||
@ -112,24 +108,19 @@ func (f *ForwardingError) WireMessage() lnwire.FailureMessage {
|
||||
// the switch or any callers to insert additional context to the error message
|
||||
// returned.
|
||||
func (f *ForwardingError) Error() string {
|
||||
if f.ExtraMsg == "" {
|
||||
return fmt.Sprintf("%v@%v", f.msg, f.FailureSourceIdx)
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"%v@%v: %v", f.msg, f.FailureSourceIdx, f.ExtraMsg,
|
||||
"%v@%v", f.msg, f.FailureSourceIdx,
|
||||
)
|
||||
}
|
||||
|
||||
// NewForwardingError creates a new payment error which wraps a wire error
|
||||
// with additional metadata.
|
||||
func NewForwardingError(failure lnwire.FailureMessage, index int,
|
||||
extraMsg string) *ForwardingError {
|
||||
func NewForwardingError(failure lnwire.FailureMessage,
|
||||
index int) *ForwardingError {
|
||||
|
||||
return &ForwardingError{
|
||||
FailureSourceIdx: index,
|
||||
msg: failure,
|
||||
ExtraMsg: extraMsg,
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,7 +190,7 @@ func (s *SphinxErrorDecrypter) DecryptError(reason lnwire.OpaqueReason) (
|
||||
return NewUnknownForwardingError(failure.SenderIdx), nil
|
||||
}
|
||||
|
||||
return NewForwardingError(failureMsg, failure.SenderIdx, ""), nil
|
||||
return NewForwardingError(failureMsg, failure.SenderIdx), nil
|
||||
}
|
||||
|
||||
// A compile time check to ensure ErrorDecrypter implements the Deobfuscator
|
||||
|
@ -400,7 +400,7 @@ func (o *mockDeobfuscator) DecryptError(reason lnwire.OpaqueReason) (*Forwarding
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return NewForwardingError(failure, 1, ""), nil
|
||||
return NewForwardingError(failure, 1), nil
|
||||
}
|
||||
|
||||
var _ ErrorDecrypter = (*mockDeobfuscator)(nil)
|
||||
|
@ -292,7 +292,7 @@ func TestSendPaymentRouteFailureFallback(t *testing.T) {
|
||||
// TODO(roasbeef): temp node failure
|
||||
// should be?
|
||||
&lnwire.FailTemporaryChannelFailure{},
|
||||
1, "",
|
||||
1,
|
||||
)
|
||||
}
|
||||
|
||||
@ -425,7 +425,7 @@ func TestChannelUpdateValidation(t *testing.T) {
|
||||
&lnwire.FailFeeInsufficient{
|
||||
Update: errChanUpdate,
|
||||
},
|
||||
1, "",
|
||||
1,
|
||||
)
|
||||
})
|
||||
|
||||
@ -550,7 +550,7 @@ func TestSendPaymentErrorRepeatedFeeInsufficient(t *testing.T) {
|
||||
// node/channel.
|
||||
&lnwire.FailFeeInsufficient{
|
||||
Update: errChanUpdate,
|
||||
}, 1, "",
|
||||
}, 1,
|
||||
)
|
||||
}
|
||||
|
||||
@ -649,7 +649,7 @@ func TestSendPaymentErrorNonFinalTimeLockErrors(t *testing.T) {
|
||||
return [32]byte{}, htlcswitch.NewForwardingError(
|
||||
&lnwire.FailExpiryTooSoon{
|
||||
Update: errChanUpdate,
|
||||
}, 1, "",
|
||||
}, 1,
|
||||
)
|
||||
}
|
||||
|
||||
@ -702,7 +702,7 @@ func TestSendPaymentErrorNonFinalTimeLockErrors(t *testing.T) {
|
||||
return [32]byte{}, htlcswitch.NewForwardingError(
|
||||
&lnwire.FailIncorrectCltvExpiry{
|
||||
Update: errChanUpdate,
|
||||
}, 1, "",
|
||||
}, 1,
|
||||
)
|
||||
}
|
||||
|
||||
@ -763,7 +763,7 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
|
||||
// sophon not having enough capacity.
|
||||
return [32]byte{}, htlcswitch.NewForwardingError(
|
||||
&lnwire.FailTemporaryChannelFailure{},
|
||||
1, "",
|
||||
1,
|
||||
)
|
||||
}
|
||||
|
||||
@ -772,7 +772,7 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
|
||||
// which should prune out the rest of the routes.
|
||||
if firstHop == roasbeefPhanNuwen {
|
||||
return [32]byte{}, htlcswitch.NewForwardingError(
|
||||
&lnwire.FailUnknownNextPeer{}, 1, "",
|
||||
&lnwire.FailUnknownNextPeer{}, 1,
|
||||
)
|
||||
}
|
||||
|
||||
@ -803,7 +803,7 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
|
||||
|
||||
if firstHop == roasbeefSongoku {
|
||||
failure := htlcswitch.NewForwardingError(
|
||||
&lnwire.FailUnknownNextPeer{}, 1, "",
|
||||
&lnwire.FailUnknownNextPeer{}, 1,
|
||||
)
|
||||
return [32]byte{}, failure
|
||||
}
|
||||
@ -850,7 +850,7 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
|
||||
// roasbeef not having enough capacity.
|
||||
return [32]byte{}, htlcswitch.NewForwardingError(
|
||||
&lnwire.FailTemporaryChannelFailure{},
|
||||
1, "",
|
||||
1,
|
||||
)
|
||||
}
|
||||
return preImage, nil
|
||||
@ -3102,7 +3102,7 @@ func TestRouterPaymentStateMachine(t *testing.T) {
|
||||
select {
|
||||
case sendResult <- htlcswitch.NewForwardingError(
|
||||
&lnwire.FailTemporaryChannelFailure{},
|
||||
1, "",
|
||||
1,
|
||||
):
|
||||
case <-time.After(1 * time.Second):
|
||||
t.Fatalf("unable to send result")
|
||||
@ -3126,7 +3126,7 @@ func TestRouterPaymentStateMachine(t *testing.T) {
|
||||
case getPaymentResultFailure:
|
||||
failure := htlcswitch.NewForwardingError(
|
||||
&lnwire.FailTemporaryChannelFailure{},
|
||||
1, "",
|
||||
1,
|
||||
)
|
||||
|
||||
select {
|
||||
@ -3302,7 +3302,7 @@ func TestSendToRouteStructuredError(t *testing.T) {
|
||||
return [32]byte{}, htlcswitch.NewForwardingError(
|
||||
&lnwire.FailFeeInsufficient{
|
||||
Update: lnwire.ChannelUpdate{},
|
||||
}, 1, "",
|
||||
}, 1,
|
||||
)
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user