From 418fe364de7eb1c6971dbcb369e3e34d63c4cf5d Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Wed, 19 Jun 2019 11:12:10 +0200 Subject: [PATCH] htlcswitch: use distinct error for unreadable failures --- htlcswitch/mock.go | 15 ++ htlcswitch/switch.go | 35 ++--- htlcswitch/switch_test.go | 104 +++++++++++++ lnrpc/routerrpc/router.pb.go | 258 ++++++++++++++++--------------- lnrpc/routerrpc/router.proto | 6 + lnrpc/routerrpc/router_server.go | 5 + routing/payment_lifecycle.go | 29 ++-- routing/router.go | 20 ++- routing/router_test.go | 89 +++++++++++ 9 files changed, 396 insertions(+), 165 deletions(-) diff --git a/htlcswitch/mock.go b/htlcswitch/mock.go index 89c053960..b5ebfcf8e 100644 --- a/htlcswitch/mock.go +++ b/htlcswitch/mock.go @@ -965,3 +965,18 @@ func (m *mockCircuitMap) NumPending() int { func (m *mockCircuitMap) NumOpen() int { return 0 } + +type mockOnionErrorDecryptor struct { + sourceIdx int + message []byte + err error +} + +func (m *mockOnionErrorDecryptor) DecryptError(encryptedData []byte) ( + *sphinx.DecryptedError, error) { + + return &sphinx.DecryptedError{ + SenderIdx: m.sourceIdx, + Message: m.message, + }, m.err +} diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index a86767452..8f6f99ece 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -58,6 +58,10 @@ var ( // active links in the switch for a specific destination. ErrNoLinksFound = errors.New("no channel links found") + // ErrUnreadableFailureMessage is returned when the failure message + // cannot be decrypted. + ErrUnreadableFailureMessage = errors.New("unreadable failure message") + // zeroPreimage is the empty preimage which is returned when we have // some errors. zeroPreimage [sha256.Size]byte @@ -936,9 +940,7 @@ func (s *Switch) extractResult(deobfuscator ErrorDecrypter, n *networkResult, // the payment deobfuscator. func (s *Switch) parseFailedPayment(deobfuscator ErrorDecrypter, paymentID uint64, paymentHash lntypes.Hash, unencrypted, - isResolution bool, htlc *lnwire.UpdateFailHTLC) *ForwardingError { - - var failure *ForwardingError + isResolution bool, htlc *lnwire.UpdateFailHTLC) error { switch { @@ -960,7 +962,8 @@ func (s *Switch) parseFailedPayment(deobfuscator ErrorDecrypter, // router. failureMsg = lnwire.NewTemporaryChannelFailure(nil) } - failure = &ForwardingError{ + + return &ForwardingError{ FailureSourceIdx: 0, ExtraMsg: userErr, FailureMessage: failureMsg, @@ -974,7 +977,8 @@ func (s *Switch) parseFailedPayment(deobfuscator ErrorDecrypter, userErr := fmt.Sprintf("payment was resolved "+ "on-chain, then cancelled back (hash=%v, pid=%d)", paymentHash, paymentID) - failure = &ForwardingError{ + + return &ForwardingError{ FailureSourceIdx: 0, ExtraMsg: userErr, FailureMessage: lnwire.FailPermanentChannelFailure{}, @@ -983,24 +987,19 @@ func (s *Switch) parseFailedPayment(deobfuscator ErrorDecrypter, // A regular multi-hop payment error that we'll need to // decrypt. default: - var err error // We'll attempt to fully decrypt the onion encrypted // error. If we're unable to then we'll bail early. - failure, err = deobfuscator.DecryptError(htlc.Reason) + failure, err := deobfuscator.DecryptError(htlc.Reason) if err != nil { - userErr := fmt.Sprintf("unable to de-obfuscate "+ - "onion failure (hash=%v, pid=%d): %v", + log.Errorf("unable to de-obfuscate onion failure "+ + "(hash=%v, pid=%d): %v", paymentHash, paymentID, err) - log.Error(userErr) - failure = &ForwardingError{ - FailureSourceIdx: 0, - ExtraMsg: userErr, - FailureMessage: lnwire.NewTemporaryChannelFailure(nil), - } - } - } - return failure + return ErrUnreadableFailureMessage + } + + return failure + } } // handlePacketForward is used in cases when we need forward the htlc update diff --git a/htlcswitch/switch_test.go b/htlcswitch/switch_test.go index 2571342a4..1e27abe9d 100644 --- a/htlcswitch/switch_test.go +++ b/htlcswitch/switch_test.go @@ -2241,3 +2241,107 @@ func TestSwitchGetPaymentResult(t *testing.T) { t.Fatalf("result not received") } } + +// TestInvalidFailure tests that the switch returns an unreadable failure error +// if the failure cannot be decrypted. +func TestInvalidFailure(t *testing.T) { + t.Parallel() + + alicePeer, err := newMockServer(t, "alice", testStartingHeight, nil, 6) + if err != nil { + t.Fatalf("unable to create alice server: %v", err) + } + + s, err := initSwitchWithDB(testStartingHeight, nil) + if err != nil { + t.Fatalf("unable to init switch: %v", err) + } + if err := s.Start(); err != nil { + t.Fatalf("unable to start switch: %v", err) + } + defer s.Stop() + + chanID1, _, aliceChanID, _ := genIDs() + + // Set up a mock channel link. + aliceChannelLink := newMockChannelLink( + s, chanID1, aliceChanID, alicePeer, true, + ) + if err := s.AddLink(aliceChannelLink); err != nil { + t.Fatalf("unable to add link: %v", err) + } + + // Create a request which should be forwarded to the mock channel link. + preimage, err := genPreimage() + if err != nil { + t.Fatalf("unable to generate preimage: %v", err) + } + rhash := fastsha256.Sum256(preimage[:]) + update := &lnwire.UpdateAddHTLC{ + PaymentHash: rhash, + Amount: 1, + } + + paymentID := uint64(123) + + // Send the request. + err = s.SendHTLC( + aliceChannelLink.ShortChanID(), paymentID, update, + ) + if err != nil { + t.Fatalf("unable to send payment: %v", err) + } + + // Catch the packet and complete the circuit so that the switch is ready + // for a response. + select { + case packet := <-aliceChannelLink.packets: + if err := aliceChannelLink.completeCircuit(packet); err != nil { + t.Fatalf("unable to complete payment circuit: %v", err) + } + + case <-time.After(time.Second): + t.Fatal("request was not propagated to destination") + } + + // Send response packet with an unreadable failure message to the + // switch. The reason failed is not relevant, because we mock the + // decryption. + packet := &htlcPacket{ + outgoingChanID: aliceChannelLink.ShortChanID(), + outgoingHTLCID: 0, + amount: 1, + htlc: &lnwire.UpdateFailHTLC{ + Reason: []byte{1, 2, 3}, + }, + } + + if err := s.forward(packet); err != nil { + t.Fatalf("can't forward htlc packet: %v", err) + } + + // Get payment result from switch. We expect an unreadable failure + // message error. + deobfuscator := SphinxErrorDecrypter{ + OnionErrorDecrypter: &mockOnionErrorDecryptor{ + err: ErrUnreadableFailureMessage, + }, + } + + resultChan, err := s.GetPaymentResult( + paymentID, rhash, &deobfuscator, + ) + if err != nil { + t.Fatal(err) + } + + select { + case result := <-resultChan: + if result.Error != ErrUnreadableFailureMessage { + t.Fatal("expected unreadable failure message") + } + + case <-time.After(time.Second): + t.Fatal("err wasn't received") + } +} diff --git a/lnrpc/routerrpc/router.pb.go b/lnrpc/routerrpc/router.pb.go index 57217669d..d303c711f 100644 --- a/lnrpc/routerrpc/router.pb.go +++ b/lnrpc/routerrpc/router.pb.go @@ -103,31 +103,36 @@ const ( Failure_TEMPORARY_NODE_FAILURE Failure_FailureCode = 19 Failure_PERMANENT_NODE_FAILURE Failure_FailureCode = 20 Failure_PERMANENT_CHANNEL_FAILURE Failure_FailureCode = 21 + //* + //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 ) var Failure_FailureCode_name = map[int32]string{ - 0: "RESERVED", - 1: "UNKNOWN_PAYMENT_HASH", - 2: "INCORRECT_PAYMENT_AMOUNT", - 3: "FINAL_INCORRECT_CLTV_EXPIRY", - 4: "FINAL_INCORRECT_HTLC_AMOUNT", - 5: "FINAL_EXPIRY_TOO_SOON", - 6: "INVALID_REALM", - 7: "EXPIRY_TOO_SOON", - 8: "INVALID_ONION_VERSION", - 9: "INVALID_ONION_HMAC", - 10: "INVALID_ONION_KEY", - 11: "AMOUNT_BELOW_MINIMUM", - 12: "FEE_INSUFFICIENT", - 13: "INCORRECT_CLTV_EXPIRY", - 14: "CHANNEL_DISABLED", - 15: "TEMPORARY_CHANNEL_FAILURE", - 16: "REQUIRED_NODE_FEATURE_MISSING", - 17: "REQUIRED_CHANNEL_FEATURE_MISSING", - 18: "UNKNOWN_NEXT_PEER", - 19: "TEMPORARY_NODE_FAILURE", - 20: "PERMANENT_NODE_FAILURE", - 21: "PERMANENT_CHANNEL_FAILURE", + 0: "RESERVED", + 1: "UNKNOWN_PAYMENT_HASH", + 2: "INCORRECT_PAYMENT_AMOUNT", + 3: "FINAL_INCORRECT_CLTV_EXPIRY", + 4: "FINAL_INCORRECT_HTLC_AMOUNT", + 5: "FINAL_EXPIRY_TOO_SOON", + 6: "INVALID_REALM", + 7: "EXPIRY_TOO_SOON", + 8: "INVALID_ONION_VERSION", + 9: "INVALID_ONION_HMAC", + 10: "INVALID_ONION_KEY", + 11: "AMOUNT_BELOW_MINIMUM", + 12: "FEE_INSUFFICIENT", + 13: "INCORRECT_CLTV_EXPIRY", + 14: "CHANNEL_DISABLED", + 15: "TEMPORARY_CHANNEL_FAILURE", + 16: "REQUIRED_NODE_FEATURE_MISSING", + 17: "REQUIRED_CHANNEL_FEATURE_MISSING", + 18: "UNKNOWN_NEXT_PEER", + 19: "TEMPORARY_NODE_FAILURE", + 20: "PERMANENT_NODE_FAILURE", + 21: "PERMANENT_CHANNEL_FAILURE", + 999: "UNREADABLE_FAILURE", } var Failure_FailureCode_value = map[string]int32{ @@ -153,6 +158,7 @@ var Failure_FailureCode_value = map[string]int32{ "TEMPORARY_NODE_FAILURE": 19, "PERMANENT_NODE_FAILURE": 20, "PERMANENT_CHANNEL_FAILURE": 21, + "UNREADABLE_FAILURE": 999, } func (x Failure_FailureCode) String() string { @@ -1167,110 +1173,110 @@ func init() { func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) } var fileDescriptor_7a0613f69d37b0a5 = []byte{ - // 1635 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0x5f, 0x73, 0x22, 0xc7, - 0x11, 0x37, 0x02, 0x09, 0xd1, 0xfc, 0xd1, 0x6a, 0xa4, 0xd3, 0xed, 0xa1, 0xd3, 0x59, 0x5e, 0x27, - 0x67, 0xd5, 0x95, 0x23, 0x39, 0xa4, 0xce, 0xe5, 0xa7, 0xa4, 0x38, 0x18, 0xcc, 0xfa, 0x60, 0x57, - 0x1e, 0xe0, 0xec, 0x4b, 0x1e, 0xa6, 0x46, 0xec, 0x08, 0xb6, 0x04, 0xbb, 0x78, 0x77, 0x70, 0x4e, - 0x79, 0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 0xd9, 0xdb, 0x50, 0x35, 0xc5, - 0xdf, 0x58, 0x06, 0xab, 0xa7, 0x5b, 0x65, 0x49, 0x7f, 0x74, 0xf4, 0x11, 0x93, 0xcd, 0xe9, 0xc1, - 0x11, 0xd7, 0xd7, 0xb5, 0xea, 0x8b, 0xc7, 0xc4, 0x89, 0x35, 0x0f, 0x8e, 0xb6, 0x74, 0x32, 0xfa, - 0x75, 0x3a, 0x82, 0x47, 0xe7, 0x40, 0xf5, 0xe5, 0xff, 0xa3, 0xad, 0xbc, 0x6c, 0x69, 0xf9, 0x35, - 0x2f, 0x8f, 0x0f, 0x8c, 0x35, 0x2f, 0x1f, 0x99, 0x1c, 0x6f, 0x7e, 0xfb, 0xc7, 0xab, 0x91, 0x2f, - 0xc6, 0xf3, 0x9b, 0xcb, 0x61, 0x38, 0xbd, 0x9a, 0xf8, 0xa3, 0xb1, 0x08, 0xfc, 0x60, 0x14, 0x70, - 0xf1, 0xe7, 0x30, 0xba, 0xbb, 0x9a, 0x04, 0xde, 0x95, 0xda, 0x44, 0xaf, 0x96, 0xe6, 0x6e, 0xf6, - 0xd4, 0xff, 0x71, 0xbf, 0xfb, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2f, 0xaa, 0x9f, 0x4e, 0xf7, - 0x0d, 0x00, 0x00, + // 1648 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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, 0x61, 0xe0, 0xbb, 0x51, 0x65, 0x57, 0x6b, 0x8c, 0xe1, 0x9e, 0x46, 0x91, 0x09, 0xa5, 0x5b, + 0xce, 0xe9, 0xc4, 0x9b, 0x7a, 0x82, 0x46, 0x4c, 0x54, 0x72, 0xca, 0xf5, 0xc2, 0x2d, 0xe7, 0x1d, + 0x89, 0xf5, 0x98, 0x90, 0xfe, 0x05, 0x73, 0x31, 0x0a, 0x3c, 0x7f, 0x44, 0x87, 0x63, 0xe6, 0x53, + 0xcf, 0xad, 0xec, 0x9d, 0xa7, 0x2e, 0x32, 0xa4, 0xbc, 0xc0, 0x1b, 0x63, 0xe6, 0x5b, 0x2e, 0x3a, + 0x03, 0x50, 0x31, 0x28, 0x75, 0x95, 0xbc, 0xb2, 0x98, 0x97, 0x88, 0xd2, 0x85, 0x6a, 0x50, 0x50, + 0x09, 0xa6, 0x63, 0xcf, 0x17, 0x51, 0x05, 0xce, 0xd3, 0x17, 0x85, 0x9a, 0x71, 0x39, 0xf1, 0x65, + 0xae, 0x89, 0x94, 0xb4, 0x3d, 0x5f, 0x90, 0x24, 0xc9, 0xfc, 0x06, 0x0e, 0xfb, 0x21, 0x1b, 0xde, + 0x6d, 0x24, 0x7f, 0x33, 0xad, 0xa9, 0x07, 0x69, 0x35, 0xff, 0x0a, 0xa5, 0xf8, 0x50, 0x4f, 0x30, + 0x31, 0x8f, 0xd0, 0x6f, 0x20, 0x1b, 0x09, 0x26, 0xb8, 0x22, 0x97, 0x6b, 0x27, 0x97, 0xcb, 0x6a, + 0x5f, 0x26, 0x88, 0x9c, 0x68, 0x16, 0xaa, 0xc2, 0xde, 0x2c, 0xe4, 0xde, 0x94, 0x8d, 0xb8, 0x2a, + 0x68, 0x91, 0x2c, 0xbf, 0x91, 0x09, 0x59, 0x75, 0x58, 0x95, 0xb3, 0x50, 0x2b, 0x26, 0x63, 0x20, + 0x5a, 0x64, 0xfe, 0x1e, 0xf6, 0xd5, 0x77, 0x8b, 0xf3, 0x0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, 0xd7, + 0x1b, 0x30, 0x70, 0x24, 0xbc, 0xa9, 0x5c, 0x1f, 0xe2, 0x85, 0x0e, 0x55, 0x13, 0xfc, 0x8d, 0x2d, + 0xb1, 0x7a, 0xba, 0x55, 0x16, 0xf7, 0x47, 0x47, 0x87, 0x18, 0xaf, 0x54, 0x0f, 0x42, 0x5c, 0xdf, + 0xe3, 0xaa, 0xcf, 0x1f, 0x13, 0xc7, 0xda, 0x5c, 0x38, 0xdc, 0xd2, 0xc9, 0xe8, 0xd7, 0x49, 0x0f, + 0x1e, 0x9d, 0x03, 0xd5, 0x17, 0xbf, 0x44, 0x5b, 0x59, 0xd9, 0xd2, 0xf2, 0x6b, 0x56, 0x1e, 0x1f, + 0x18, 0x6b, 0x56, 0x3e, 0x30, 0x39, 0x5e, 0xff, 0xf6, 0x8f, 0x57, 0x23, 0x4f, 0x8c, 0xe7, 0x37, + 0x97, 0xc3, 0x60, 0x7a, 0x35, 0xf1, 0x46, 0x63, 0xe1, 0x7b, 0xfe, 0xc8, 0xe7, 0xe2, 0xcf, 0x41, + 0x78, 0x77, 0x35, 0xf1, 0xdd, 0x2b, 0xb5, 0xa2, 0x5e, 0x2d, 0xd5, 0xdd, 0xec, 0xaa, 0x7f, 0xf0, + 0x7e, 0xf7, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x28, 0x1a, 0x3a, 0x10, 0x0e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/lnrpc/routerrpc/router.proto b/lnrpc/routerrpc/router.proto index 2581ce595..670dd06e6 100644 --- a/lnrpc/routerrpc/router.proto +++ b/lnrpc/routerrpc/router.proto @@ -194,6 +194,12 @@ message Failure { TEMPORARY_NODE_FAILURE = 19; PERMANENT_NODE_FAILURE = 20; PERMANENT_CHANNEL_FAILURE = 21; + + /** + An unreadable failure result is returned if the received failure message + cannot be decrypted. In that case the error source is unknown. + */ + UNREADABLE_FAILURE = 999; } /// Failure code as defined in the Lightning spec diff --git a/lnrpc/routerrpc/router_server.go b/lnrpc/routerrpc/router_server.go index 21bc233e9..21ef6a660 100644 --- a/lnrpc/routerrpc/router_server.go +++ b/lnrpc/routerrpc/router_server.go @@ -310,6 +310,11 @@ func (s *Server) SendToRoute(ctx context.Context, func marshallError(sendError error) (*Failure, error) { response := &Failure{} + if sendError == htlcswitch.ErrUnreadableFailureMessage { + response.Code = Failure_UNREADABLE_FAILURE + return response, nil + } + fErr, ok := sendError.(*htlcswitch.ForwardingError) if !ok { return nil, sendError diff --git a/routing/payment_lifecycle.go b/routing/payment_lifecycle.go index cec91e9dd..32f6883ea 100644 --- a/routing/payment_lifecycle.go +++ b/routing/payment_lifecycle.go @@ -17,7 +17,7 @@ import ( type errNoRoute struct { // lastError is the error encountered during the last payment attempt, // if at least one attempt has been made. - lastError *htlcswitch.ForwardingError + lastError error } // Error returns a string representation of the error. @@ -37,7 +37,7 @@ type paymentLifecycle struct { finalCLTVDelta uint16 attempt *channeldb.PaymentAttemptInfo circuit *sphinx.Circuit - lastError *htlcswitch.ForwardingError + lastError error } // resumePayment resumes the paymentLifecycle from the current state. @@ -341,25 +341,16 @@ func (p *paymentLifecycle) sendPaymentAttempt(firstHop lnwire.ShortChannelID, // handleSendError inspects the given error from the Switch and determines // whether we should make another payment attempt. func (p *paymentLifecycle) handleSendError(sendErr error) error { - var reason channeldb.FailureReason - // If an internal, non-forwarding error occurred, we can stop trying. - fErr, ok := sendErr.(*htlcswitch.ForwardingError) - if !ok { - reason = channeldb.FailureReasonError - } else { - var final bool - final, reason = p.router.processSendError( - p.paySession, &p.attempt.Route, fErr, - ) + final, reason := p.router.processSendError( + p.paySession, &p.attempt.Route, sendErr, + ) + if !final { + // Save the forwarding error so it can be returned if + // this turns out to be the last attempt. + p.lastError = sendErr - if !final { - // Save the forwarding error so it can be returned if - // this turns out to be the last attempt. - p.lastError = fErr - - return nil - } + return nil } log.Debugf("Payment %x failed: final_outcome=%v, raw_err=%v", diff --git a/routing/router.go b/routing/router.go index 63f77a319..f67387a6c 100644 --- a/routing/router.go +++ b/routing/router.go @@ -1812,8 +1812,24 @@ func (r *ChannelRouter) sendPayment( // to continue with an alternative route. This is indicated by the boolean // return value. func (r *ChannelRouter) processSendError(paySession PaymentSession, - rt *route.Route, fErr *htlcswitch.ForwardingError) ( - bool, channeldb.FailureReason) { + rt *route.Route, sendErr error) (bool, channeldb.FailureReason) { + + // If the failure message could not be decrypted, attribute the failure + // to our own outgoing channel. + // + // TODO(joostager): Penalize all channels in the route. + if sendErr == htlcswitch.ErrUnreadableFailureMessage { + sendErr = &htlcswitch.ForwardingError{ + FailureSourceIdx: 0, + FailureMessage: lnwire.NewTemporaryChannelFailure(nil), + } + } + + // If an internal, non-forwarding error occurred, we can stop trying. + fErr, ok := sendErr.(*htlcswitch.ForwardingError) + if !ok { + return true, channeldb.FailureReasonError + } var ( failureSourceIdx = fErr.FailureSourceIdx diff --git a/routing/router_test.go b/routing/router_test.go index aa01b2ff4..f83ef7ba8 100644 --- a/routing/router_test.go +++ b/routing/router_test.go @@ -2425,6 +2425,95 @@ func TestEmptyRoutesGenerateSphinxPacket(t *testing.T) { } } +// TestUnknownErrorSource tests that if the source of an error is unknown, all +// edges along the route will be pruned. +func TestUnknownErrorSource(t *testing.T) { + t.Parallel() + + // Setup a network. It contains two paths to c: a->b->c and an + // alternative a->d->c. + chanCapSat := btcutil.Amount(100000) + testChannels := []*testChannel{ + symmetricTestChannel("a", "b", chanCapSat, &testChannelPolicy{ + Expiry: 144, + FeeRate: 400, + MinHTLC: 1, + MaxHTLC: lnwire.NewMSatFromSatoshis(chanCapSat), + }, 1), + symmetricTestChannel("b", "c", chanCapSat, &testChannelPolicy{ + Expiry: 144, + FeeRate: 400, + MinHTLC: 1, + MaxHTLC: lnwire.NewMSatFromSatoshis(chanCapSat), + }, 3), + symmetricTestChannel("a", "d", chanCapSat, &testChannelPolicy{ + Expiry: 144, + FeeRate: 400, + FeeBaseMsat: 100000, + MinHTLC: 1, + MaxHTLC: lnwire.NewMSatFromSatoshis(chanCapSat), + }, 2), + symmetricTestChannel("d", "c", chanCapSat, &testChannelPolicy{ + Expiry: 144, + FeeRate: 400, + FeeBaseMsat: 100000, + MinHTLC: 1, + MaxHTLC: lnwire.NewMSatFromSatoshis(chanCapSat), + }, 4), + } + + testGraph, err := createTestGraphFromChannels(testChannels, "a") + defer testGraph.cleanUp() + if err != nil { + t.Fatalf("unable to create graph: %v", err) + } + + const startingBlockHeight = 101 + + ctx, cleanUp, err := createTestCtxFromGraphInstance(startingBlockHeight, + testGraph) + + defer cleanUp() + if err != nil { + t.Fatalf("unable to create router: %v", err) + } + + // Create a payment to node c. + payment := LightningPayment{ + Target: ctx.aliases["c"], + Amount: lnwire.NewMSatFromSatoshis(1000), + FeeLimit: noFeeLimit, + PaymentHash: lntypes.Hash{}, + } + + // We'll modify the SendToSwitch method so that it simulates hop b as a + // node that returns an unparsable failure if approached via the a->b + // channel. + ctx.router.cfg.Payer.(*mockPaymentAttemptDispatcher).setPaymentResult( + func(firstHop lnwire.ShortChannelID) ([32]byte, error) { + + // If channel a->b is used, return an error without + // source and message. The sender won't know the origin + // of the error. + if firstHop.ToUint64() == 1 { + return [32]byte{}, + htlcswitch.ErrUnreadableFailureMessage + } + + // Otherwise the payment succeeds. + return lntypes.Preimage{}, nil + }) + + // Send off the payment request to the router. The expectation is that + // the route a->b->c is tried first. An unreadable faiure is returned + // which should pruning the channel a->b. We expect the payment to + // succeed via a->d. + _, _, err = ctx.router.SendPayment(&payment) + if err != nil { + t.Fatalf("expected payment to succeed, but got: %v", err) + } +} + // assertChannelsPruned ensures that only the given channels are pruned from the // graph out of the set of all channels. func assertChannelsPruned(t *testing.T, graph *channeldb.ChannelGraph,