From 8681729561e4e7beb143e6827078cdacb7eb3d5d Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Thu, 4 Jul 2019 09:09:53 +0200 Subject: [PATCH 1/5] htlcswitch/test: extract failure code assertion to function --- htlcswitch/link_test.go | 35 ++++++++++++++++++----------------- htlcswitch/switch_test.go | 8 +------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go index fc34422e7..10322dbd4 100644 --- a/htlcswitch/link_test.go +++ b/htlcswitch/link_test.go @@ -11,7 +11,6 @@ import ( "net" "reflect" "runtime" - "strings" "sync" "testing" "time" @@ -623,12 +622,8 @@ func TestExitNodeAmountPayloadMismatch(t *testing.T) { ).Wait(30 * time.Second) if err == nil { t.Fatalf("payment should have failed but didn't") - } else if !strings.Contains(err.Error(), lnwire.CodeUnknownPaymentHash.String()) { - // TODO(roasbeef): use proper error after error propagation is - // in - t.Fatalf("expected %v got %v", err, - lnwire.CodeUnknownPaymentHash) } + assertFailureCode(t, err, lnwire.CodeUnknownPaymentHash) } // TestLinkForwardTimelockPolicyMismatch tests that if a node is an @@ -1025,9 +1020,8 @@ func TestChannelLinkMultiHopInsufficientPayment(t *testing.T) { ).Wait(30 * time.Second) if err == nil { t.Fatal("error haven't been received") - } else if !strings.Contains(err.Error(), "insufficient capacity") { - t.Fatalf("wrong error has been received: %v", err) } + assertFailureCode(t, err, lnwire.CodeTemporaryChannelFailure) // Wait for Alice to receive the revocation. // @@ -1136,10 +1130,7 @@ func TestChannelLinkMultiHopUnknownPaymentHash(t *testing.T) { t.Fatalf("no result arrive") } - fErr := result.Error - if !strings.Contains(fErr.Error(), lnwire.CodeUnknownPaymentHash.String()) { - t.Fatalf("expected %v got %v", lnwire.CodeUnknownPaymentHash, fErr) - } + assertFailureCode(t, result.Error, lnwire.CodeUnknownPaymentHash) // Wait for Alice to receive the revocation. time.Sleep(100 * time.Millisecond) @@ -5846,11 +5837,7 @@ func TestChannelLinkHoldInvoiceCancel(t *testing.T) { // Wait for payment to succeed. err = <-ctx.errChan - if !strings.Contains(err.Error(), - lnwire.CodeUnknownPaymentHash.String()) { - - t.Fatal("expected unknown payment hash") - } + assertFailureCode(t, err, lnwire.CodeUnknownPaymentHash) } // TestChannelLinkHoldInvoiceRestart asserts hodl htlcs are held after blocks @@ -6081,3 +6068,17 @@ func TestChannelLinkRevocationWindowHodl(t *testing.T) { default: } } + +// assertFailureCode asserts that an error is of type ForwardingError and that +// the failure code is as expected. +func assertFailureCode(t *testing.T, err error, code lnwire.FailCode) { + fErr, ok := err.(*ForwardingError) + if !ok { + t.Fatalf("expected ForwardingError but got %T", err) + } + + if fErr.FailureMessage.Code() != code { + t.Fatalf("expected %v but got %v", + code, fErr.FailureMessage.Code()) + } +} diff --git a/htlcswitch/switch_test.go b/htlcswitch/switch_test.go index 13f6acc37..7ed01dead 100644 --- a/htlcswitch/switch_test.go +++ b/htlcswitch/switch_test.go @@ -1824,14 +1824,8 @@ func TestSwitchSendPayment(t *testing.T) { select { case err := <-errChan: - fErr, ok := err.(*ForwardingError) - if !ok { - t.Fatal("expected ForwardingError") - } + assertFailureCode(t, err, lnwire.CodeUnknownPaymentHash) - if _, ok := fErr.FailureMessage.(*lnwire.FailUnknownPaymentHash); !ok { - t.Fatalf("expected UnknownPaymentHash got %v", fErr) - } case <-time.After(time.Second): t.Fatal("err wasn't received") } From aabd68ebcd6cdf77e84f29f3f0805feb3d29bc0a Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Wed, 12 Jun 2019 11:35:54 +0200 Subject: [PATCH 2/5] multi: rename FailUnknownPaymentHash to FailIncorrectDetails Align naming better with the lightning spec. Not the full name of the failure (FailIncorrectOrUnknownPaymentDetails) is used, because this would cause too many long lines in the code. --- htlcswitch/link.go | 6 +- htlcswitch/link_test.go | 10 +- htlcswitch/switch_test.go | 7 +- lnrpc/routerrpc/router.pb.go | 304 +++++++++++++-------------- lnrpc/routerrpc/router.proto | 2 +- lnrpc/routerrpc/router_server.go | 4 +- lntest/itest/lnd_test.go | 4 +- lnwire/onion_error.go | 80 +++---- lnwire/onion_error_test.go | 12 +- routing/missioncontrol.go | 2 +- routing/missioncontrol_store_test.go | 2 +- 11 files changed, 219 insertions(+), 214 deletions(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 98e717f38..a6b47f164 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -1216,7 +1216,7 @@ func (l *channelLink) processHodlEvent(hodlEvent invoices.HodlEvent, case invoices.CancelInvoiceUnknown: fallthrough case invoices.CancelInvoiceCanceled: - failure = lnwire.NewFailUnknownPaymentHash( + failure = lnwire.NewFailIncorrectDetails( htlc.pd.Amount, ) @@ -2843,7 +2843,7 @@ func (l *channelLink) processExitHop(pd *lnwallet.PaymentDescriptor, "value: expected %v, got %v", pd.RHash, pd.Amount, fwdInfo.AmountToForward) - failure := lnwire.NewFailUnknownPaymentHash(pd.Amount) + failure := lnwire.NewFailIncorrectDetails(pd.Amount) l.sendHTLCError(pd.HtlcIndex, failure, obfuscator, pd.SourceRef) return true, nil @@ -2878,7 +2878,7 @@ func (l *channelLink) processExitHop(pd *lnwallet.PaymentDescriptor, // Cancel htlc if we don't have an invoice for it. case channeldb.ErrInvoiceNotFound: - failure := lnwire.NewFailUnknownPaymentHash(pd.Amount) + failure := lnwire.NewFailIncorrectDetails(pd.Amount) l.sendHTLCError(pd.HtlcIndex, failure, obfuscator, pd.SourceRef) return true, nil diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go index 10322dbd4..762ebf089 100644 --- a/htlcswitch/link_test.go +++ b/htlcswitch/link_test.go @@ -623,7 +623,7 @@ func TestExitNodeAmountPayloadMismatch(t *testing.T) { if err == nil { t.Fatalf("payment should have failed but didn't") } - assertFailureCode(t, err, lnwire.CodeUnknownPaymentHash) + assertFailureCode(t, err, lnwire.CodeIncorrectOrUnknownPaymentDetails) } // TestLinkForwardTimelockPolicyMismatch tests that if a node is an @@ -1130,7 +1130,9 @@ func TestChannelLinkMultiHopUnknownPaymentHash(t *testing.T) { t.Fatalf("no result arrive") } - assertFailureCode(t, result.Error, lnwire.CodeUnknownPaymentHash) + assertFailureCode( + t, result.Error, lnwire.CodeIncorrectOrUnknownPaymentDetails, + ) // Wait for Alice to receive the revocation. time.Sleep(100 * time.Millisecond) @@ -5668,7 +5670,7 @@ func TestChannelLinkCanceledInvoice(t *testing.T) { if !ok { t.Fatalf("expected ForwardingError, but got %v", err) } - _, ok = fErr.FailureMessage.(*lnwire.FailUnknownPaymentHash) + _, ok = fErr.FailureMessage.(*lnwire.FailIncorrectDetails) if !ok { t.Fatalf("expected unknown payment hash, but got %v", err) } @@ -5837,7 +5839,7 @@ func TestChannelLinkHoldInvoiceCancel(t *testing.T) { // Wait for payment to succeed. err = <-ctx.errChan - assertFailureCode(t, err, lnwire.CodeUnknownPaymentHash) + assertFailureCode(t, err, lnwire.CodeIncorrectOrUnknownPaymentDetails) } // TestChannelLinkHoldInvoiceRestart asserts hodl htlcs are held after blocks diff --git a/htlcswitch/switch_test.go b/htlcswitch/switch_test.go index 7ed01dead..6e8a1698d 100644 --- a/htlcswitch/switch_test.go +++ b/htlcswitch/switch_test.go @@ -1803,7 +1803,7 @@ func TestSwitchSendPayment(t *testing.T) { // the add htlc request with error and sent the htlc fail request // back. This request should be forwarded back to alice channel link. obfuscator := NewMockObfuscator() - failure := lnwire.NewFailUnknownPaymentHash(update.Amount) + failure := lnwire.NewFailIncorrectDetails(update.Amount) reason, err := obfuscator.EncryptFirstHop(failure) if err != nil { t.Fatalf("unable obfuscate failure: %v", err) @@ -1824,8 +1824,9 @@ func TestSwitchSendPayment(t *testing.T) { select { case err := <-errChan: - assertFailureCode(t, err, lnwire.CodeUnknownPaymentHash) - + assertFailureCode( + t, err, lnwire.CodeIncorrectOrUnknownPaymentDetails, + ) 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 cba7914d7..2cff06fdc 100644 --- a/lnrpc/routerrpc/router.pb.go +++ b/lnrpc/routerrpc/router.pb.go @@ -81,28 +81,28 @@ const ( //The numbers assigned in this enumeration match the failure codes as //defined in BOLT #4. Because protobuf 3 requires enums to start with 0, //a RESERVED value is added. - Failure_RESERVED Failure_FailureCode = 0 - Failure_UNKNOWN_PAYMENT_HASH Failure_FailureCode = 1 - Failure_INCORRECT_PAYMENT_AMOUNT Failure_FailureCode = 2 - Failure_FINAL_INCORRECT_CLTV_EXPIRY Failure_FailureCode = 3 - Failure_FINAL_INCORRECT_HTLC_AMOUNT Failure_FailureCode = 4 - Failure_FINAL_EXPIRY_TOO_SOON Failure_FailureCode = 5 - Failure_INVALID_REALM Failure_FailureCode = 6 - Failure_EXPIRY_TOO_SOON Failure_FailureCode = 7 - Failure_INVALID_ONION_VERSION Failure_FailureCode = 8 - Failure_INVALID_ONION_HMAC Failure_FailureCode = 9 - Failure_INVALID_ONION_KEY Failure_FailureCode = 10 - Failure_AMOUNT_BELOW_MINIMUM Failure_FailureCode = 11 - Failure_FEE_INSUFFICIENT Failure_FailureCode = 12 - Failure_INCORRECT_CLTV_EXPIRY Failure_FailureCode = 13 - Failure_CHANNEL_DISABLED Failure_FailureCode = 14 - Failure_TEMPORARY_CHANNEL_FAILURE Failure_FailureCode = 15 - Failure_REQUIRED_NODE_FEATURE_MISSING Failure_FailureCode = 16 - Failure_REQUIRED_CHANNEL_FEATURE_MISSING Failure_FailureCode = 17 - Failure_UNKNOWN_NEXT_PEER Failure_FailureCode = 18 - Failure_TEMPORARY_NODE_FAILURE Failure_FailureCode = 19 - Failure_PERMANENT_NODE_FAILURE Failure_FailureCode = 20 - Failure_PERMANENT_CHANNEL_FAILURE Failure_FailureCode = 21 + Failure_RESERVED Failure_FailureCode = 0 + Failure_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS Failure_FailureCode = 1 + Failure_INCORRECT_PAYMENT_AMOUNT Failure_FailureCode = 2 + Failure_FINAL_INCORRECT_CLTV_EXPIRY Failure_FailureCode = 3 + Failure_FINAL_INCORRECT_HTLC_AMOUNT Failure_FailureCode = 4 + Failure_FINAL_EXPIRY_TOO_SOON Failure_FailureCode = 5 + Failure_INVALID_REALM Failure_FailureCode = 6 + Failure_EXPIRY_TOO_SOON Failure_FailureCode = 7 + Failure_INVALID_ONION_VERSION Failure_FailureCode = 8 + Failure_INVALID_ONION_HMAC Failure_FailureCode = 9 + Failure_INVALID_ONION_KEY Failure_FailureCode = 10 + Failure_AMOUNT_BELOW_MINIMUM Failure_FailureCode = 11 + Failure_FEE_INSUFFICIENT Failure_FailureCode = 12 + Failure_INCORRECT_CLTV_EXPIRY Failure_FailureCode = 13 + Failure_CHANNEL_DISABLED Failure_FailureCode = 14 + Failure_TEMPORARY_CHANNEL_FAILURE Failure_FailureCode = 15 + Failure_REQUIRED_NODE_FEATURE_MISSING Failure_FailureCode = 16 + Failure_REQUIRED_CHANNEL_FEATURE_MISSING Failure_FailureCode = 17 + Failure_UNKNOWN_NEXT_PEER Failure_FailureCode = 18 + Failure_TEMPORARY_NODE_FAILURE Failure_FailureCode = 19 + 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 @@ -114,7 +114,7 @@ const ( var Failure_FailureCode_name = map[int32]string{ 0: "RESERVED", - 1: "UNKNOWN_PAYMENT_HASH", + 1: "INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS", 2: "INCORRECT_PAYMENT_AMOUNT", 3: "FINAL_INCORRECT_CLTV_EXPIRY", 4: "FINAL_INCORRECT_HTLC_AMOUNT", @@ -140,30 +140,30 @@ var Failure_FailureCode_name = map[int32]string{ } var Failure_FailureCode_value = map[string]int32{ - "RESERVED": 0, - "UNKNOWN_PAYMENT_HASH": 1, - "INCORRECT_PAYMENT_AMOUNT": 2, - "FINAL_INCORRECT_CLTV_EXPIRY": 3, - "FINAL_INCORRECT_HTLC_AMOUNT": 4, - "FINAL_EXPIRY_TOO_SOON": 5, - "INVALID_REALM": 6, - "EXPIRY_TOO_SOON": 7, - "INVALID_ONION_VERSION": 8, - "INVALID_ONION_HMAC": 9, - "INVALID_ONION_KEY": 10, - "AMOUNT_BELOW_MINIMUM": 11, - "FEE_INSUFFICIENT": 12, - "INCORRECT_CLTV_EXPIRY": 13, - "CHANNEL_DISABLED": 14, - "TEMPORARY_CHANNEL_FAILURE": 15, - "REQUIRED_NODE_FEATURE_MISSING": 16, - "REQUIRED_CHANNEL_FEATURE_MISSING": 17, - "UNKNOWN_NEXT_PEER": 18, - "TEMPORARY_NODE_FAILURE": 19, - "PERMANENT_NODE_FAILURE": 20, - "PERMANENT_CHANNEL_FAILURE": 21, - "UNKNOWN_FAILURE": 998, - "UNREADABLE_FAILURE": 999, + "RESERVED": 0, + "INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS": 1, + "INCORRECT_PAYMENT_AMOUNT": 2, + "FINAL_INCORRECT_CLTV_EXPIRY": 3, + "FINAL_INCORRECT_HTLC_AMOUNT": 4, + "FINAL_EXPIRY_TOO_SOON": 5, + "INVALID_REALM": 6, + "EXPIRY_TOO_SOON": 7, + "INVALID_ONION_VERSION": 8, + "INVALID_ONION_HMAC": 9, + "INVALID_ONION_KEY": 10, + "AMOUNT_BELOW_MINIMUM": 11, + "FEE_INSUFFICIENT": 12, + "INCORRECT_CLTV_EXPIRY": 13, + "CHANNEL_DISABLED": 14, + "TEMPORARY_CHANNEL_FAILURE": 15, + "REQUIRED_NODE_FEATURE_MISSING": 16, + "REQUIRED_CHANNEL_FEATURE_MISSING": 17, + "UNKNOWN_NEXT_PEER": 18, + "TEMPORARY_NODE_FAILURE": 19, + "PERMANENT_NODE_FAILURE": 20, + "PERMANENT_CHANNEL_FAILURE": 21, + "UNKNOWN_FAILURE": 998, + "UNREADABLE_FAILURE": 999, } func (x Failure_FailureCode) String() string { @@ -1178,111 +1178,111 @@ func init() { func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) } var fileDescriptor_7a0613f69d37b0a5 = []byte{ - // 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, 0x54, 0xe5, 0x92, 0xcf, 0x92, 0x5c, 0x73, 0xc9, 0xc7, 0x49, 0xbe, 0x43, 0x4e, 0xa9, - 0xee, 0x1e, 0x60, 0x40, 0x68, 0xb3, 0x27, 0x31, 0xbf, 0xdf, 0xaf, 0xdf, 0xeb, 0x7e, 0xaf, 0xdf, - 0xeb, 0x27, 0x38, 0x0e, 0x83, 0xb9, 0xe0, 0x61, 0x38, 0x1b, 0x5e, 0xe9, 0x5f, 0x97, 0xb3, 0x30, - 0x10, 0x01, 0xca, 0x2f, 0xf1, 0x6a, 0x3e, 0x9c, 0x0d, 0x35, 0x6a, 0xfe, 0x77, 0x07, 0x50, 0x8f, - 0xfb, 0xee, 0x35, 0xbb, 0x9f, 0x72, 0x5f, 0x10, 0xfe, 0xd3, 0x9c, 0x47, 0x02, 0x21, 0xc8, 0xb8, - 0x3c, 0x12, 0x95, 0xd4, 0x79, 0xea, 0xa2, 0x48, 0xd4, 0x6f, 0x64, 0x40, 0x9a, 0x4d, 0x45, 0x65, - 0xe7, 0x3c, 0x75, 0x91, 0x26, 0xf2, 0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, 0xcf, 0xc5, 0x1f, 0x83, 0xf0, 0xee, 0x6a, 0xe2, 0xbb, - 0x57, 0x6a, 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, + // 1663 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0x4f, 0x77, 0x22, 0xc7, + 0x11, 0x37, 0x02, 0x84, 0x28, 0xfe, 0x8d, 0x5a, 0x5a, 0x89, 0x45, 0xab, 0xb5, 0x8c, 0x9d, 0xb5, + 0xde, 0x3e, 0x47, 0x72, 0xc8, 0x5b, 0x3f, 0x9f, 0x92, 0xc7, 0x42, 0x63, 0x8d, 0x17, 0x66, 0xe4, + 0x06, 0xd6, 0xde, 0xe4, 0xd0, 0xaf, 0xc5, 0xb4, 0x60, 0x9e, 0x60, 0x06, 0xcf, 0x34, 0xce, 0x2a, + 0x87, 0xdc, 0x72, 0xcc, 0x3d, 0xdf, 0x22, 0xf9, 0x04, 0xb9, 0xe7, 0x8b, 0x24, 0xdf, 0x21, 0xa7, + 0xbc, 0xee, 0x9e, 0x81, 0x01, 0xa1, 0xb5, 0x4f, 0x62, 0x7e, 0xbf, 0x5f, 0x57, 0x75, 0x57, 0x75, + 0x55, 0x97, 0xe0, 0x28, 0xf0, 0x17, 0x82, 0x07, 0xc1, 0x7c, 0x74, 0xa9, 0x7f, 0x5d, 0xcc, 0x03, + 0x5f, 0xf8, 0x28, 0xbf, 0xc4, 0x6b, 0xf9, 0x60, 0x3e, 0xd2, 0x68, 0xfd, 0x7f, 0x3b, 0x80, 0xfa, + 0xdc, 0x73, 0xae, 0xd9, 0xfd, 0x8c, 0x7b, 0x82, 0xf0, 0x1f, 0x17, 0x3c, 0x14, 0x08, 0x41, 0xc6, + 0xe1, 0xa1, 0xa8, 0xa6, 0xce, 0x52, 0xe7, 0x45, 0xa2, 0x7e, 0x23, 0x03, 0xd2, 0x6c, 0x26, 0xaa, + 0x3b, 0x67, 0xa9, 0xf3, 0x34, 0x91, 0x3f, 0xd1, 0x27, 0x50, 0x9c, 0xeb, 0x75, 0x74, 0xc2, 0xc2, + 0x49, 0x35, 0xad, 0xd4, 0x85, 0x08, 0xbb, 0x62, 0xe1, 0x04, 0x9d, 0x83, 0x71, 0xeb, 0x7a, 0x6c, + 0x4a, 0x47, 0x53, 0xf1, 0x13, 0x75, 0xf8, 0x54, 0xb0, 0x6a, 0xe6, 0x2c, 0x75, 0x9e, 0x25, 0x65, + 0x85, 0xb7, 0xa6, 0xe2, 0xa7, 0xb6, 0x44, 0xd1, 0xe7, 0x50, 0x89, 0x8d, 0x05, 0x7a, 0x17, 0xd5, + 0xec, 0x59, 0xea, 0x3c, 0x4f, 0xca, 0xf3, 0xf5, 0xbd, 0x7d, 0x0e, 0x15, 0xe1, 0xce, 0xb8, 0xbf, + 0x10, 0x34, 0xe4, 0x23, 0xdf, 0x73, 0xc2, 0xea, 0xae, 0xb6, 0x18, 0xc1, 0x7d, 0x8d, 0xa2, 0x3a, + 0x94, 0x6e, 0x39, 0xa7, 0x53, 0x77, 0xe6, 0x0a, 0x1a, 0x32, 0x51, 0xcd, 0xa9, 0xad, 0x17, 0x6e, + 0x39, 0xef, 0x4a, 0xac, 0xcf, 0x84, 0xdc, 0x9f, 0xbf, 0x10, 0x63, 0xdf, 0xf5, 0xc6, 0x74, 0x34, + 0x61, 0x1e, 0x75, 0x9d, 0xea, 0xde, 0x59, 0xea, 0x3c, 0x43, 0xca, 0x31, 0xde, 0x9a, 0x30, 0xcf, + 0x74, 0xd0, 0x29, 0x80, 0x3a, 0x83, 0x32, 0x57, 0xcd, 0x2b, 0x8f, 0x79, 0x89, 0x28, 0x5b, 0xa8, + 0x01, 0x05, 0x15, 0x60, 0x3a, 0x71, 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 0x79, 0x3c, 0x04, + 0x14, 0x0e, 0xd6, 0x8c, 0x47, 0xa7, 0x48, 0x46, 0x36, 0xb5, 0x11, 0xd9, 0x2f, 0x20, 0x77, 0xcb, + 0xdc, 0xe9, 0x22, 0x88, 0x0d, 0xa3, 0x44, 0x9a, 0x3a, 0x9a, 0x21, 0xb1, 0xa4, 0xfe, 0xef, 0x1c, + 0xe4, 0x22, 0x10, 0x35, 0x20, 0x33, 0xf2, 0x9d, 0x38, 0xbb, 0xcf, 0x1f, 0x2e, 0x8b, 0xff, 0xb6, + 0x7c, 0x87, 0x13, 0xa5, 0x45, 0xbf, 0x87, 0xb2, 0xbc, 0xd1, 0x1e, 0x9f, 0xd2, 0xc5, 0xdc, 0x61, + 0xcb, 0x84, 0x56, 0x13, 0xab, 0x5b, 0x5a, 0x30, 0x54, 0x3c, 0x29, 0x8d, 0x92, 0x9f, 0xe8, 0x04, + 0xf2, 0x13, 0x31, 0x1d, 0xe9, 0x4c, 0x64, 0x54, 0x51, 0xec, 0x49, 0x40, 0xe5, 0xa0, 0x0e, 0x25, + 0xdf, 0x73, 0x7d, 0x8f, 0x86, 0x13, 0x46, 0x1b, 0xaf, 0xbe, 0x52, 0xc5, 0x5a, 0x24, 0x05, 0x05, + 0xf6, 0x27, 0xac, 0xf1, 0xea, 0x2b, 0xf4, 0x31, 0x14, 0x54, 0xc9, 0xf0, 0xf7, 0x73, 0x37, 0xb8, + 0x57, 0x55, 0x5a, 0x22, 0xaa, 0x8a, 0xb0, 0x42, 0xd0, 0x21, 0x64, 0x6f, 0xa7, 0x6c, 0x1c, 0xaa, + 0xca, 0x2c, 0x11, 0xfd, 0x81, 0xbe, 0x84, 0xc3, 0x28, 0x06, 0x34, 0xf4, 0x17, 0xc1, 0x88, 0x53, + 0xd7, 0x73, 0xf8, 0x7b, 0x55, 0x97, 0x25, 0x82, 0x22, 0xae, 0xaf, 0x28, 0x53, 0x32, 0xf5, 0xbf, + 0x67, 0xa1, 0x90, 0x08, 0x00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, 0x6c, 0x26, + 0xcc, 0xf5, 0x74, 0x87, 0xd2, 0x1d, 0x3a, 0xaf, 0x10, 0xd5, 0x9f, 0x8e, 0x21, 0x17, 0x3f, 0x56, + 0x69, 0x55, 0x97, 0xbb, 0x23, 0xfd, 0x48, 0x3d, 0x83, 0xbc, 0x6c, 0x81, 0xa1, 0x60, 0xb3, 0xb9, + 0x2a, 0xd9, 0x12, 0x59, 0x01, 0xe8, 0x53, 0x28, 0xcd, 0x78, 0x18, 0xb2, 0x31, 0xa7, 0xba, 0xec, + 0x40, 0x29, 0x8a, 0x11, 0xd8, 0x51, 0xd5, 0xf7, 0x29, 0xc4, 0x6d, 0x20, 0x12, 0x65, 0xb5, 0x28, + 0x02, 0xb5, 0x68, 0xb3, 0x03, 0x0b, 0x16, 0x55, 0x77, 0xb2, 0x03, 0x0b, 0x86, 0x5e, 0xc2, 0xbe, + 0x6e, 0x21, 0xae, 0xe7, 0xce, 0x16, 0x33, 0xdd, 0x4a, 0x72, 0x6a, 0xcb, 0x15, 0xd5, 0x4a, 0x34, + 0xae, 0x3a, 0xca, 0x53, 0xd8, 0xbb, 0x61, 0x21, 0x97, 0xcd, 0x3f, 0x2a, 0xf5, 0x9c, 0xfc, 0xee, + 0x70, 0x2e, 0x29, 0xf9, 0x24, 0x04, 0xb2, 0x89, 0xe5, 0x35, 0x75, 0xcb, 0x39, 0x91, 0x71, 0x5c, + 0x7a, 0x60, 0xef, 0x57, 0x1e, 0x0a, 0x09, 0x0f, 0x1a, 0x57, 0x1e, 0x5e, 0xc2, 0x3e, 0x7f, 0x2f, + 0x02, 0x46, 0xfd, 0x39, 0xfb, 0x71, 0xc1, 0xa9, 0xc3, 0x04, 0xab, 0x16, 0x55, 0x70, 0x2b, 0x8a, + 0xb0, 0x15, 0xde, 0x66, 0x82, 0xd5, 0x9f, 0x41, 0x8d, 0xf0, 0x90, 0x8b, 0x9e, 0x1b, 0x86, 0xae, + 0xef, 0xb5, 0x7c, 0x4f, 0x04, 0xf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0x0d, + 0x63, 0xcd, 0xcb, 0x07, 0x3a, 0xc7, 0xeb, 0xdf, 0xfc, 0xe1, 0x72, 0xec, 0x8a, 0xc9, 0xe2, 0xe6, + 0x62, 0xe4, 0xcf, 0x2e, 0xa7, 0xee, 0x78, 0x22, 0x3c, 0xd7, 0x1b, 0x7b, 0x5c, 0xfc, 0xc9, 0x0f, + 0xee, 0x2e, 0xa7, 0x9e, 0x73, 0xa9, 0x06, 0xd9, 0xcb, 0xa5, 0xb9, 0x9b, 0x5d, 0xf5, 0x6f, 0xe0, + 0x6f, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x58, 0x80, 0x4d, 0xdb, 0x36, 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 18f08444a..f44da67d0 100644 --- a/lnrpc/routerrpc/router.proto +++ b/lnrpc/routerrpc/router.proto @@ -173,7 +173,7 @@ message Failure { */ RESERVED = 0; - UNKNOWN_PAYMENT_HASH = 1; + INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS = 1; INCORRECT_PAYMENT_AMOUNT = 2; FINAL_INCORRECT_CLTV_EXPIRY = 3; FINAL_INCORRECT_HTLC_AMOUNT = 4; diff --git a/lnrpc/routerrpc/router_server.go b/lnrpc/routerrpc/router_server.go index 64b88f620..2ed268004 100644 --- a/lnrpc/routerrpc/router_server.go +++ b/lnrpc/routerrpc/router_server.go @@ -322,8 +322,8 @@ func marshallError(sendError error) (*Failure, error) { switch onionErr := fErr.FailureMessage.(type) { - case *lnwire.FailUnknownPaymentHash: - response.Code = Failure_UNKNOWN_PAYMENT_HASH + case *lnwire.FailIncorrectDetails: + response.Code = Failure_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS case *lnwire.FailIncorrectPaymentAmount: response.Code = Failure_INCORRECT_PAYMENT_AMOUNT diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index 53674d5a4..58838abed 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -8664,7 +8664,7 @@ out: t.Fatalf("payment should have been rejected due to invalid " + "payment hash") } - expectedErrorCode := lnwire.CodeUnknownPaymentHash.String() + expectedErrorCode := lnwire.CodeIncorrectOrUnknownPaymentDetails.String() if !strings.Contains(resp.PaymentError, expectedErrorCode) { // TODO(roasbeef): make into proper gRPC error code t.Fatalf("payment should have failed due to unknown payment hash, "+ @@ -8696,7 +8696,7 @@ out: t.Fatalf("payment should have been rejected due to wrong " + "HTLC amount") } - expectedErrorCode = lnwire.CodeUnknownPaymentHash.String() + expectedErrorCode = lnwire.CodeIncorrectOrUnknownPaymentDetails.String() if !strings.Contains(resp.PaymentError, expectedErrorCode) { t.Fatalf("payment should have failed due to wrong amount, "+ "instead failed due to: %v", resp.PaymentError) diff --git a/lnwire/onion_error.go b/lnwire/onion_error.go index c363aa49a..51f3bc581 100644 --- a/lnwire/onion_error.go +++ b/lnwire/onion_error.go @@ -55,29 +55,29 @@ type FailCode uint16 // The currently defined onion failure types within this current version of the // Lightning protocol. const ( - CodeNone FailCode = 0 - CodeInvalidRealm = FlagBadOnion | 1 - CodeTemporaryNodeFailure = FlagNode | 2 - CodePermanentNodeFailure = FlagPerm | FlagNode | 2 - CodeRequiredNodeFeatureMissing = FlagPerm | FlagNode | 3 - CodeInvalidOnionVersion = FlagBadOnion | FlagPerm | 4 - CodeInvalidOnionHmac = FlagBadOnion | FlagPerm | 5 - CodeInvalidOnionKey = FlagBadOnion | FlagPerm | 6 - CodeTemporaryChannelFailure = FlagUpdate | 7 - CodePermanentChannelFailure = FlagPerm | 8 - CodeRequiredChannelFeatureMissing = FlagPerm | 9 - CodeUnknownNextPeer = FlagPerm | 10 - CodeAmountBelowMinimum = FlagUpdate | 11 - CodeFeeInsufficient = FlagUpdate | 12 - CodeIncorrectCltvExpiry = FlagUpdate | 13 - CodeExpiryTooSoon = FlagUpdate | 14 - CodeChannelDisabled = FlagUpdate | 20 - CodeUnknownPaymentHash = FlagPerm | 15 - CodeIncorrectPaymentAmount = FlagPerm | 16 - CodeFinalExpiryTooSoon FailCode = 17 - CodeFinalIncorrectCltvExpiry FailCode = 18 - CodeFinalIncorrectHtlcAmount FailCode = 19 - CodeExpiryTooFar FailCode = 21 + CodeNone FailCode = 0 + CodeInvalidRealm = FlagBadOnion | 1 + CodeTemporaryNodeFailure = FlagNode | 2 + CodePermanentNodeFailure = FlagPerm | FlagNode | 2 + CodeRequiredNodeFeatureMissing = FlagPerm | FlagNode | 3 + CodeInvalidOnionVersion = FlagBadOnion | FlagPerm | 4 + CodeInvalidOnionHmac = FlagBadOnion | FlagPerm | 5 + CodeInvalidOnionKey = FlagBadOnion | FlagPerm | 6 + CodeTemporaryChannelFailure = FlagUpdate | 7 + CodePermanentChannelFailure = FlagPerm | 8 + CodeRequiredChannelFeatureMissing = FlagPerm | 9 + CodeUnknownNextPeer = FlagPerm | 10 + CodeAmountBelowMinimum = FlagUpdate | 11 + CodeFeeInsufficient = FlagUpdate | 12 + CodeIncorrectCltvExpiry = FlagUpdate | 13 + CodeExpiryTooSoon = FlagUpdate | 14 + CodeChannelDisabled = FlagUpdate | 20 + CodeIncorrectOrUnknownPaymentDetails = FlagPerm | 15 + CodeIncorrectPaymentAmount = FlagPerm | 16 + CodeFinalExpiryTooSoon FailCode = 17 + CodeFinalIncorrectCltvExpiry FailCode = 18 + CodeFinalIncorrectHtlcAmount FailCode = 19 + CodeExpiryTooFar FailCode = 21 ) // String returns the string representation of the failure code. @@ -134,8 +134,8 @@ func (c FailCode) String() string { case CodeChannelDisabled: return "ChannelDisabled" - case CodeUnknownPaymentHash: - return "UnknownPaymentHash" + case CodeIncorrectOrUnknownPaymentDetails: + return "IncorrectOrUnknownPaymentDetails" case CodeFinalExpiryTooSoon: return "FinalExpiryTooSoon" @@ -317,7 +317,7 @@ func (f *FailIncorrectPaymentAmount) Error() string { return f.Code().String() } -// FailUnknownPaymentHash is returned for two reasons: +// FailIncorrectDetails is returned for two reasons: // // 1) if the payment hash has already been paid, the final node MAY treat the // payment hash as unknown, or may succeed in accepting the HTLC. If the @@ -330,42 +330,44 @@ func (f *FailIncorrectPaymentAmount) Error() string { // gross overpayment. // // NOTE: May only be returned by the final node in the path. -type FailUnknownPaymentHash struct { +type FailIncorrectDetails struct { // amount is the value of the extended HTLC. amount MilliSatoshi } -// NewFailUnknownPaymentHash makes a new instance of the FailUnknownPaymentHash +// NewFailIncorrectDetails makes a new instance of the FailIncorrectDetails // error bound to the specified HTLC amount. -func NewFailUnknownPaymentHash(amt MilliSatoshi) *FailUnknownPaymentHash { - return &FailUnknownPaymentHash{ +func NewFailIncorrectDetails(amt MilliSatoshi) *FailIncorrectDetails { + return &FailIncorrectDetails{ amount: amt, } } // Amount is the value of the extended HTLC. -func (f *FailUnknownPaymentHash) Amount() MilliSatoshi { +func (f *FailIncorrectDetails) Amount() MilliSatoshi { return f.amount } // Code returns the failure unique code. // // NOTE: Part of the FailureMessage interface. -func (f *FailUnknownPaymentHash) Code() FailCode { - return CodeUnknownPaymentHash +func (f *FailIncorrectDetails) Code() FailCode { + return CodeIncorrectOrUnknownPaymentDetails } // Returns a human readable string describing the target FailureMessage. // // NOTE: Implements the error interface. -func (f *FailUnknownPaymentHash) Error() string { - return fmt.Sprintf("UnknownPaymentHash(amt=%v)", f.amount) +func (f *FailIncorrectDetails) Error() string { + return fmt.Sprintf( + "%v(amt=%v)", CodeIncorrectOrUnknownPaymentDetails, f.amount, + ) } // Decode decodes the failure from bytes stream. // // NOTE: Part of the Serializable interface. -func (f *FailUnknownPaymentHash) Decode(r io.Reader, pver uint32) error { +func (f *FailIncorrectDetails) Decode(r io.Reader, pver uint32) error { err := ReadElement(r, &f.amount) switch { // This is an optional tack on that was added later in the protocol. As @@ -385,7 +387,7 @@ func (f *FailUnknownPaymentHash) Decode(r io.Reader, pver uint32) error { // Encode writes the failure in bytes stream. // // NOTE: Part of the Serializable interface. -func (f *FailUnknownPaymentHash) Encode(w io.Writer, pver uint32) error { +func (f *FailIncorrectDetails) Encode(w io.Writer, pver uint32) error { return WriteElement(w, f.amount) } @@ -1228,8 +1230,8 @@ func makeEmptyOnionError(code FailCode) (FailureMessage, error) { case CodeUnknownNextPeer: return &FailUnknownNextPeer{}, nil - case CodeUnknownPaymentHash: - return &FailUnknownPaymentHash{}, nil + case CodeIncorrectOrUnknownPaymentDetails: + return &FailIncorrectDetails{}, nil case CodeIncorrectPaymentAmount: return &FailIncorrectPaymentAmount{}, nil diff --git a/lnwire/onion_error_test.go b/lnwire/onion_error_test.go index 9ecb9f1a9..21fe3fcd4 100644 --- a/lnwire/onion_error_test.go +++ b/lnwire/onion_error_test.go @@ -36,7 +36,7 @@ var onionFailures = []FailureMessage{ &FailIncorrectPaymentAmount{}, &FailFinalExpiryTooSoon{}, - NewFailUnknownPaymentHash(99), + NewFailIncorrectDetails(99), NewInvalidOnionVersion(testOnionHash), NewInvalidOnionHmac(testOnionHash), NewInvalidOnionKey(testOnionHash), @@ -168,16 +168,16 @@ func TestWriteOnionErrorChanUpdate(t *testing.T) { } } -// TestFailUnknownPaymentHashOptionalAmount tests that we're able to decode an -// UnknownPaymentHash error that doesn't have the optional amount. This ensures -// we're able to decode FailUnknownPaymentHash messages from older nodes. -func TestFailUnknownPaymentHashOptionalAmount(t *testing.T) { +// TestFailIncorrectDetailsOptionalAmount tests that we're able to decode an +// FailIncorrectDetails error that doesn't have the optional amount. This +// ensures we're able to decode FailIncorrectDetails messages from older nodes. +func TestFailIncorrectDetailsOptionalAmount(t *testing.T) { t.Parallel() // Creation an error that is a non-pointer will allow us to skip the // type assertion for the Serializable interface. As a result, the // amount body won't be written. - onionError := &FailUnknownPaymentHash{} + onionError := &FailIncorrectDetails{} var b bytes.Buffer if err := EncodeFailure(&b, onionError, 0); err != nil { diff --git a/routing/missioncontrol.go b/routing/missioncontrol.go index e85fb19af..a14773f6e 100644 --- a/routing/missioncontrol.go +++ b/routing/missioncontrol.go @@ -527,7 +527,7 @@ func (m *MissionControl) applyPaymentResult(result *paymentResult) ( // If the end destination didn't know the payment // hash or we sent the wrong payment amount to the // destination, then we'll terminate immediately. - case *lnwire.FailUnknownPaymentHash: + case *lnwire.FailIncorrectDetails: // TODO(joostjager): Check onionErr.Amount() whether it matches // what we expect. (Will it ever not match, because if not // final_incorrect_htlc_amount would be returned?) diff --git a/routing/missioncontrol_store_test.go b/routing/missioncontrol_store_test.go index 43d150fac..6afbe4f99 100644 --- a/routing/missioncontrol_store_test.go +++ b/routing/missioncontrol_store_test.go @@ -59,7 +59,7 @@ func TestMissionControlStore(t *testing.T) { result1 := paymentResult{ route: &testRoute, - failure: lnwire.NewFailUnknownPaymentHash(100), + failure: lnwire.NewFailIncorrectDetails(100), failureSourceIdx: &failureSourceIdx, id: 99, timeReply: testTime, From 45b3c647f739f42e199e281aa4cc81934b0042ef Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Wed, 12 Jun 2019 13:23:21 +0200 Subject: [PATCH 3/5] htlcswitch: return final_incorrect_htlc_amount on onion payload mismatch This commit fixes exit hop behavior to be in line with the lightning spec. --- htlcswitch/link.go | 2 +- htlcswitch/link_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index a6b47f164..26a90d0ea 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -2843,7 +2843,7 @@ func (l *channelLink) processExitHop(pd *lnwallet.PaymentDescriptor, "value: expected %v, got %v", pd.RHash, pd.Amount, fwdInfo.AmountToForward) - failure := lnwire.NewFailIncorrectDetails(pd.Amount) + failure := lnwire.NewFinalIncorrectHtlcAmount(pd.Amount) l.sendHTLCError(pd.HtlcIndex, failure, obfuscator, pd.SourceRef) return true, nil diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go index 762ebf089..4635d2317 100644 --- a/htlcswitch/link_test.go +++ b/htlcswitch/link_test.go @@ -623,7 +623,7 @@ func TestExitNodeAmountPayloadMismatch(t *testing.T) { if err == nil { t.Fatalf("payment should have failed but didn't") } - assertFailureCode(t, err, lnwire.CodeIncorrectOrUnknownPaymentDetails) + assertFailureCode(t, err, lnwire.CodeFinalIncorrectHtlcAmount) } // TestLinkForwardTimelockPolicyMismatch tests that if a node is an From 922f133fd273990704966b8e1cb0534804fa592c Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Tue, 25 Jun 2019 14:55:23 +0200 Subject: [PATCH 4/5] htlcswitch: report incoming htlc time lock with FinalIncorrectCltvExpiry Previously the time lock in the onion payload was reported. This is no new information to the sender. --- htlcswitch/link.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 26a90d0ea..f39e41aac 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -2856,9 +2856,7 @@ func (l *channelLink) processExitHop(pd *lnwallet.PaymentDescriptor, "time-lock: expected %v, got %v", pd.RHash[:], pd.Timeout, fwdInfo.OutgoingCTLV) - failure := lnwire.NewFinalIncorrectCltvExpiry( - fwdInfo.OutgoingCTLV, - ) + failure := lnwire.NewFinalIncorrectCltvExpiry(pd.Timeout) l.sendHTLCError(pd.HtlcIndex, failure, obfuscator, pd.SourceRef) return true, nil From 98fac9fb99b44e0dc24d212759af933b9ec16ddb Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Tue, 11 Jun 2019 08:54:29 +0200 Subject: [PATCH 5/5] htlcswitch+invoices: always return incorrect_or_unknown_payment_details In order to prevent information leaks by nodes probing with a payment hash, this commit changes exit hop processing so that it always returns incorrect_or_unknown_payment_details and leaves the prober in the dark about whether an invoice actually exists. --- htlcswitch/link.go | 28 +++++--------------- htlcswitch/link_test.go | 6 ++--- invoices/invoiceregistry.go | 51 +++---------------------------------- 3 files changed, 14 insertions(+), 71 deletions(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index f39e41aac..9e9405293 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -1204,29 +1204,15 @@ func (l *channelLink) processHodlEvent(hodlEvent invoices.HodlEvent, ) } } else { - l.debugf("Received hodl cancel event for %v, reason=%v", - hash, hodlEvent.CancelReason) + l.debugf("Received hodl cancel event for %v", hash) hodlAction = func(htlc hodlHtlc) error { - var failure lnwire.FailureMessage - switch hodlEvent.CancelReason { - - case invoices.CancelAmountTooLow: - fallthrough - case invoices.CancelInvoiceUnknown: - fallthrough - case invoices.CancelInvoiceCanceled: - failure = lnwire.NewFailIncorrectDetails( - htlc.pd.Amount, - ) - - case invoices.CancelExpiryTooSoon: - failure = &lnwire.FailFinalExpiryTooSoon{} - - default: - return fmt.Errorf("unknown cancel reason: %v", - hodlEvent.CancelReason) - } + // In case of a cancel, always return + // incorrect_or_unknown_payment_details in order to + // avoid leaking info. + failure := lnwire.NewFailIncorrectDetails( + htlc.pd.Amount, + ) l.sendHTLCError( htlc.pd.HtlcIndex, failure, htlc.obfuscator, diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go index 4635d2317..31236e4eb 100644 --- a/htlcswitch/link_test.go +++ b/htlcswitch/link_test.go @@ -1413,10 +1413,10 @@ func TestChannelLinkExpiryTooSoonExitNode(t *testing.T) { } switch ferr.FailureMessage.(type) { - case *lnwire.FailFinalExpiryTooSoon: + case *lnwire.FailIncorrectDetails: default: - t.Fatalf("incorrect error, expected final time lock too "+ - "early, instead have: %v", err) + t.Fatalf("expected incorrect_or_unknown_payment_details, "+ + "instead have: %v", err) } } diff --git a/invoices/invoiceregistry.go b/invoices/invoiceregistry.go index 9a7add0e9..9d4985818 100644 --- a/invoices/invoiceregistry.go +++ b/invoices/invoiceregistry.go @@ -28,41 +28,6 @@ var ( DebugHash = DebugPre.Hash() ) -// HtlcCancelReason defines reasons for which htlcs can be canceled. -type HtlcCancelReason uint8 - -const ( - // CancelInvoiceUnknown is returned if the preimage is unknown. - CancelInvoiceUnknown HtlcCancelReason = iota - - // CancelExpiryTooSoon is returned when the timelock of the htlc - // does not satisfy the invoice cltv expiry requirement. - CancelExpiryTooSoon - - // CancelInvoiceCanceled is returned when the invoice is already - // canceled and can't be paid to anymore. - CancelInvoiceCanceled - - // CancelAmountTooLow is returned when the amount paid is too low. - CancelAmountTooLow -) - -// String returns a human readable identifier for the cancel reason. -func (r HtlcCancelReason) String() string { - switch r { - case CancelInvoiceUnknown: - return "InvoiceUnknown" - case CancelExpiryTooSoon: - return "ExpiryTooSoon" - case CancelInvoiceCanceled: - return "InvoiceCanceled" - case CancelAmountTooLow: - return "CancelAmountTooLow" - default: - return "Unknown" - } -} - var ( // ErrInvoiceExpiryTooSoon is returned when an invoice is attempted to be // accepted or settled with not enough blocks remaining. @@ -82,10 +47,6 @@ type HodlEvent struct { // Hash is the htlc hash. Hash lntypes.Hash - - // CancelReason specifies the reason why invoice registry decided to - // cancel the htlc. - CancelReason HtlcCancelReason } // InvoiceRegistry is a central registry of all the outstanding invoices @@ -644,8 +605,7 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash, debugLog("invoice already canceled") return &HodlEvent{ - Hash: rHash, - CancelReason: CancelInvoiceCanceled, + Hash: rHash, }, nil // If invoice is already accepted, add this htlc to the list of @@ -661,8 +621,7 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash, debugLog("expiry too soon") return &HodlEvent{ - Hash: rHash, - CancelReason: CancelExpiryTooSoon, + Hash: rHash, }, nil // If there are not enough blocks left, cancel the htlc. @@ -670,8 +629,7 @@ func (i *InvoiceRegistry) NotifyExitHopHtlc(rHash lntypes.Hash, debugLog("amount too low") return &HodlEvent{ - Hash: rHash, - CancelReason: CancelAmountTooLow, + Hash: rHash, }, nil // If this call settled the invoice, settle the htlc. Otherwise @@ -750,8 +708,7 @@ func (i *InvoiceRegistry) CancelInvoice(payHash lntypes.Hash) error { log.Debugf("Invoice(%v): canceled", payHash) i.notifyHodlSubscribers(HodlEvent{ - Hash: payHash, - CancelReason: CancelInvoiceCanceled, + Hash: payHash, }) i.notifyClients(payHash, invoice, channeldb.ContractCanceled)