Skip to content

Commit 18545d8

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 18545d8

File tree

2 files changed

+71
-33
lines changed

2 files changed

+71
-33
lines changed

zpay32/invoice.go

+6
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,12 @@ 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 && invoice.PaymentAddr.IsNone() {
387+
return fmt.Errorf("no payment address found")
388+
}
389+
384390
if len(invoice.RouteHints) != 0 &&
385391
len(invoice.BlindedPaymentPaths) != 0 {
386392

0 commit comments

Comments
 (0)