Skip to content

Commit 811aac3

Browse files
committed
multi: make payment address mandatory
Make the payment secret field ('s') mandatory for BOLT11 payment requests, implementing the requirement specified in BOLT11 spec PR lightning/bolts#1242. This enhances privacy by preventing intermediate nodes from probing the destination using payment onions. This commit implements the following changes: - Adds validation in `zpay32` to fail decoding if the 's' field is missing when no blinded path is provided. - Adds a test vector for an invoice missing the 's' field. - Updates existing tests to accommodate the mandatory payment address requirement.
1 parent 867d27d commit 811aac3

File tree

2 files changed

+72
-33
lines changed

2 files changed

+72
-33
lines changed

zpay32/invoice.go

+7
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,13 @@ func validateInvoice(invoice *Invoice) error {
381381
return fmt.Errorf("no payment hash found")
382382
}
383383

384+
// The invoice must contain a payment address (payment secret)
385+
// if it does not contain blinded paths.
386+
if len(invoice.BlindedPaymentPaths) == 0 &&
387+
invoice.PaymentAddr.IsNone() {
388+
return fmt.Errorf("no payment address found")
389+
}
390+
384391
if len(invoice.RouteHints) != 0 &&
385392
len(invoice.BlindedPaymentPaths) != 0 {
386393

0 commit comments

Comments
 (0)