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.
This commit is contained in:
11 files changed
+219
-214
No files matched your search
+3
-3
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user