Skip to content

Commit ada4d4e

Browse files
committed
cmd/payments: reject invoices without payment secret or blinded paths
Ensure that a payment is only sent if the invoice includes either a payment address (payment secret) or at least one blinded path. This enforces invoice security requirements and prevents insecure payment attempts.
1 parent c9fe051 commit ada4d4e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/commands/cmd_payments.go

+8
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,14 @@ func SendPaymentRequest(ctx *cli.Context, req *routerrpc.SendPaymentRequest,
588588
amt = invoiceAmt
589589
}
590590

591+
// An invoice must include either a payment address or
592+
// blinded paths.
593+
if (len(decodeResp.PaymentAddr) == 0) &&
594+
decodeResp.BlindedPaths == nil {
595+
return fmt.Errorf("invoice must contain either a " +
596+
"payment address or blinded paths")
597+
}
598+
591599
// Calculate fee limit based on the determined amount.
592600
feeLimit, err = retrieveFeeLimit(ctx, amt)
593601
if err != nil {

0 commit comments

Comments
 (0)