htlcswitch: return final_incorrect_htlc_amount on onion payload mismatch

This commit fixes exit hop behavior to be in line with the lightning
spec.
This commit is contained in:
Joost Jager 2019-06-12 13:23:21 +02:00
parent aabd68ebcd
commit 45b3c647f7
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
2 changed files with 2 additions and 2 deletions

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

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