htlcswitch: do not consider unknown failures an error

This commit is contained in:
Joost Jager 2019-06-19 15:09:23 +02:00
parent c6f9517e48
commit 2726f50d7c
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
7 changed files with 186 additions and 112 deletions

@ -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{

@ -2344,4 +2344,37 @@ func TestInvalidFailure(t *testing.T) {
case <-time.After(time.Second):
t.Fatal("err wasn't received")
}
// Modify the decryption to simulate that decryption went alright, but
// the failure cannot be decoded.
deobfuscator = SphinxErrorDecrypter{
OnionErrorDecrypter: &mockOnionErrorDecryptor{
sourceIdx: 2,
message: []byte{200},
},
}
resultChan, err = s.GetPaymentResult(
paymentID, rhash, &deobfuscator,
)
if err != nil {
t.Fatal(err)
}
select {
case result := <-resultChan:
fErr, ok := result.Error.(*ForwardingError)
if !ok {
t.Fatal("expected ForwardingError")
}
if fErr.FailureSourceIdx != 2 {
t.Fatal("unexpected error source index")
}
if fErr.FailureMessage != nil {
t.Fatal("expected empty failure message")
}
case <-time.After(time.Second):
t.Fatal("err wasn't received")
}
}

@ -104,6 +104,9 @@ const (
Failure_PERMANENT_NODE_FAILURE Failure_FailureCode = 20
Failure_PERMANENT_CHANNEL_FAILURE Failure_FailureCode = 21
//*
//The error source is known, but the failure itself couldn't be decoded.
Failure_UNKNOWN_FAILURE Failure_FailureCode = 998
//*
//An unreadable failure result is returned if the received failure message
//cannot be decrypted. In that case the error source is unknown.
Failure_UNREADABLE_FAILURE Failure_FailureCode = 999
@ -132,6 +135,7 @@ var Failure_FailureCode_name = map[int32]string{
19: "TEMPORARY_NODE_FAILURE",
20: "PERMANENT_NODE_FAILURE",
21: "PERMANENT_CHANNEL_FAILURE",
998: "UNKNOWN_FAILURE",
999: "UNREADABLE_FAILURE",
}
@ -158,6 +162,7 @@ var Failure_FailureCode_value = map[string]int32{
"TEMPORARY_NODE_FAILURE": 19,
"PERMANENT_NODE_FAILURE": 20,
"PERMANENT_CHANNEL_FAILURE": 21,
"UNKNOWN_FAILURE": 998,
"UNREADABLE_FAILURE": 999,
}
@ -1173,110 +1178,111 @@ func init() {
func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) }
var fileDescriptor_7a0613f69d37b0a5 = []byte{
// 1648 bytes of a gzipped FileDescriptorProto
// 1659 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0x4f, 0x73, 0x22, 0xc7,
0x15, 0x37, 0x02, 0x84, 0x78, 0xfc, 0xd1, 0xa8, 0xa5, 0x95, 0x58, 0xb4, 0x5a, 0xcb, 0xe3, 0x64,
0xad, 0xda, 0x72, 0x24, 0x87, 0xd4, 0xba, 0x7c, 0x4a, 0x8a, 0x85, 0xc6, 0x8c, 0x17, 0x66, 0xe4,
0x06, 0xd6, 0xde, 0xe4, 0xd0, 0xd5, 0x62, 0x5a, 0x30, 0x25, 0x98, 0xc1, 0x33, 0x8d, 0xb3, 0xca,
0x21, 0xb7, 0x1c, 0xf3, 0x29, 0xf2, 0x01, 0x92, 0x4f, 0x90, 0xaf, 0x93, 0x7b, 0x8e, 0x39, 0xa5,
0xba, 0x7b, 0x80, 0x01, 0xa1, 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6a, 0x70, 0xbd, 0x5a, 0x9a, 0xbb, 0xd9, 0x55, 0xff, 0xf6, 0xfd, 0xe6, 0x7f, 0x01, 0x00,
0x00, 0xff, 0xff, 0xcc, 0x5a, 0xee, 0x77, 0x26, 0x0e, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

@ -195,6 +195,11 @@ message Failure {
PERMANENT_NODE_FAILURE = 20;
PERMANENT_CHANNEL_FAILURE = 21;
/**
The error source is known, but the failure itself couldn't be decoded.
*/
UNKNOWN_FAILURE = 998;
/**
An unreadable failure result is returned if the received failure message
cannot be decrypted. In that case the error source is unknown.

@ -399,9 +399,8 @@ func marshallError(sendError error) (*Failure, error) {
case *lnwire.FailPermanentChannelFailure:
response.Code = Failure_PERMANENT_CHANNEL_FAILURE
default:
return nil, errors.New("unknown wire error")
response.Code = Failure_UNKNOWN_FAILURE
}
response.FailureSourceIndex = uint32(fErr.FailureSourceIdx)

@ -2076,8 +2076,10 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
}, 0)
return false, 0
// Any other failure or an empty failure will get the node pruned.
default:
return true, channeldb.FailureReasonError
paySession.ReportVertexFailure(failureVertex)
return false, 0
}
}

@ -751,7 +751,7 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
// roasbeef not having enough capacity.
return [32]byte{}, &htlcswitch.ForwardingError{
FailureSourceIdx: 0,
FailureMessage: &lnwire.FailTemporaryChannelFailure{},
FailureMessage: &lnwire.FailTemporaryChannelFailure{},
}
}
@ -762,7 +762,7 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
if firstHop == roasbeefSatoshi {
return [32]byte{}, &htlcswitch.ForwardingError{
FailureSourceIdx: 1,
FailureMessage: &lnwire.FailUnknownNextPeer{},
FailureMessage: &lnwire.FailUnknownNextPeer{},
}
}
@ -795,7 +795,7 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
if firstHop == roasbeefLuoji {
return [32]byte{}, &htlcswitch.ForwardingError{
FailureSourceIdx: 0,
FailureMessage: &lnwire.FailUnknownNextPeer{},
FailureMessage: &lnwire.FailUnknownNextPeer{},
}
}
@ -841,7 +841,7 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
// roasbeef not having enough capacity.
return [32]byte{}, &htlcswitch.ForwardingError{
FailureSourceIdx: 0,
FailureMessage: &lnwire.FailTemporaryChannelFailure{},
FailureMessage: &lnwire.FailTemporaryChannelFailure{},
}
}
return preImage, nil
@ -2512,6 +2512,31 @@ func TestUnknownErrorSource(t *testing.T) {
if err != nil {
t.Fatalf("expected payment to succeed, but got: %v", err)
}
// Next we modify payment result to return an unknown failure.
ctx.router.cfg.Payer.(*mockPaymentAttemptDispatcher).setPaymentResult(
func(firstHop lnwire.ShortChannelID) ([32]byte, error) {
// If channel a->b is used, simulate that the failure
// couldn't be decoded (FailureMessage is nil).
if firstHop.ToUint64() == 2 {
return [32]byte{},
&htlcswitch.ForwardingError{
FailureSourceIdx: 1,
}
}
// Otherwise the payment succeeds.
return lntypes.Preimage{}, nil
})
// Send off the payment request to the router. We expect the payment to
// fail because both routes have been pruned.
payment.PaymentHash = lntypes.Hash{1}
_, _, err = ctx.router.SendPayment(&payment)
if err == nil {
t.Fatalf("expected payment to fail")
}
}
// assertChannelsPruned ensures that only the given channels are pruned from the
@ -3055,7 +3080,7 @@ func TestRouterPaymentStateMachine(t *testing.T) {
select {
case sendResult <- &htlcswitch.ForwardingError{
FailureSourceIdx: 1,
FailureMessage: &lnwire.FailTemporaryChannelFailure{},
FailureMessage: &lnwire.FailTemporaryChannelFailure{},
}:
case <-time.After(1 * time.Second):
t.Fatalf("unable to send result")
@ -3081,7 +3106,7 @@ func TestRouterPaymentStateMachine(t *testing.T) {
case getPaymentResult <- &htlcswitch.PaymentResult{
Error: &htlcswitch.ForwardingError{
FailureSourceIdx: 1,
FailureMessage: &lnwire.FailTemporaryChannelFailure{},
FailureMessage: &lnwire.FailTemporaryChannelFailure{},
},
}:
case <-time.After(1 * time.Second):