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