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:
parent
aabd68ebcd
commit
45b3c647f7
@ -2843,7 +2843,7 @@ func (l *channelLink) processExitHop(pd *lnwallet.PaymentDescriptor,
|
|||||||
"value: expected %v, got %v", pd.RHash,
|
"value: expected %v, got %v", pd.RHash,
|
||||||
pd.Amount, fwdInfo.AmountToForward)
|
pd.Amount, fwdInfo.AmountToForward)
|
||||||
|
|
||||||
failure := lnwire.NewFailIncorrectDetails(pd.Amount)
|
failure := lnwire.NewFinalIncorrectHtlcAmount(pd.Amount)
|
||||||
l.sendHTLCError(pd.HtlcIndex, failure, obfuscator, pd.SourceRef)
|
l.sendHTLCError(pd.HtlcIndex, failure, obfuscator, pd.SourceRef)
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
|
@ -623,7 +623,7 @@ func TestExitNodeAmountPayloadMismatch(t *testing.T) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("payment should have failed but didn't")
|
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
|
// TestLinkForwardTimelockPolicyMismatch tests that if a node is an
|
||||||
|
Loading…
Reference in New Issue
Block a user