You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting `keysend` indicates that the payer supports receiving a
447
+
`payment_hash`-less invoice in response to their `invoice_request`, and
448
+
subsequently setting `keysend_payment_preimage` in their payment onion.
449
+
450
+
Useful if the payee is often offline and the invoice is being returned on
451
+
their behalf by another node, to avoid trusting that other node to not reuse a
452
+
`payment_hash`.
453
+
412
454
## Requirements for Invoice Requests
413
455
414
456
The writer:
@@ -486,7 +528,14 @@ The reader:
486
528
- MUST fail the request if bitcoin is not a supported chain.
487
529
- otherwise:
488
530
- MUST fail the request if `invreq_chain`.`chain` is not a supported chain.
489
-
531
+
- if `offer_features` supports `async_receive`:
532
+
- if the payee is online:
533
+
- MUST forward the `invoice_request` to the payee
534
+
- otherwise (payee is offline):
535
+
- if `invreq_features` supports `keysend`:
536
+
- MUST reply with the static keysend invoice previously provided by the payee
537
+
- otherwise:
538
+
- MUST reply with `invoice_error`
490
539
491
540
## Rationale
492
541
@@ -515,10 +564,11 @@ informative for the payer to know how the sender claims
515
564
516
565
# Invoices
517
566
518
-
Invoices are a payment request, and when the payment is made,
519
-
it can be combined with the invoice to form a cryptographic receipt.
567
+
Invoices are a payment request. If `invoice_payment_hash` is set, then when the
568
+
payment is made, the payment preimage can be combined with the invoice to form a
569
+
cryptographic receipt.
520
570
521
-
The recipient sends an `invoice`in response to an `invoice_request` using
571
+
The recipient creates an `invoice`for responding to an `invoice_request` using
522
572
the `onion_message``invoice` field.
523
573
524
574
1.`tlv_stream`: `invoice`
@@ -604,6 +654,9 @@ the `onion_message` `invoice` field.
604
654
1. type: 176 (`invoice_node_id`)
605
655
2. data:
606
656
*[`point`:`node_id`]
657
+
1. type: 178 (`invoice_message_paths`)
658
+
2. data:
659
+
*[`...*blinded_path`:`paths`]
607
660
1. type: 240 (`signature`)
608
661
2. data:
609
662
*[`bip340sig`:`sig`]
@@ -645,18 +698,24 @@ A writer of an invoice:
645
698
- MUST set `invoice_amount` to the minimum amount it will accept, in units of
646
699
the minimal lightning-payable unit (e.g. milli-satoshis for bitcoin) for
647
700
`invreq_chain`.
648
-
- if the invoice is in response to an `invoice_request`:
701
+
- if `invoice_payment_hash` is set and the invoice is in response to an `invoice_request`:
649
702
- MUST copy all non-signature fields from the `invoice_request` (including unknown fields).
650
703
- if `invreq_amount` is present:
651
704
- MUST set `invoice_amount` to `invreq_amount`
652
705
- otherwise:
653
706
- MUST set `invoice_amount` to the *expected amount*.
654
-
- otherwise (invoice not requested, e.g. for user to scan directly):
707
+
- otherwise if the invoice was not requested (e.g. for user to scan directly):
655
708
- MUST set `invreq_chain` as it would for an invoice_request.
656
709
- MUST set `offer_description` as it would for an offer.
657
710
- MUST NOT set `invreq_payer_id` or `offer_node_id`.
658
-
- MUST set `invoice_payment_hash` to the SHA256 hash of the
659
-
`payment_preimage` that will be given in return for payment.
711
+
- if the invoice is intended to be provided by a node other than the recipient:
712
+
- MUST set `invreq_chain` as it would for an invoice_request.
713
+
- MUST NOT set `invoice_payment_hash`.
714
+
- MUST include `invoice_message_paths` containing at least two paths to
715
+
the recipient, where the penultimate hop supports `option_om_mailbox`.
716
+
- otherwise:
717
+
- MUST set `invoice_payment_hash` to the SHA256 hash of the
718
+
`payment_preimage` that will be given in return for payment.
660
719
- if `offer_node_id` is present:
661
720
- MUST set `invoice_node_id` to `offer_node_id`.
662
721
- otherwise:
@@ -682,15 +741,16 @@ A writer of an invoice:
682
741
- MUST include `invoice_blindedpay` with exactly one `blinded_payinfo` for each `blinded_path` in `paths`, in order.
683
742
- MUST set `features` in each `blinded_payinfo` to match `encrypted_data_tlv`.`allowed_features` (or empty, if no `allowed_features`).
684
743
- SHOULD ignore any payment which does not use one of the paths.
685
-
- if `offer_node_id` is present, and `invreq_payer_id` is identical to a previous `invoice_request`:
686
-
- MAY simply reuse the previous invoice.
744
+
- if `offer_node_id` is present, and `invreq_payer_id` is identical to a previous `invoice_request`, or if providing invoices on behalf of an often offline recipient:
745
+
- MAY reuse the previous invoice.
687
746
- otherwise:
688
747
- MUST NOT reuse a previous invoice.
689
748
690
749
A reader of an invoice:
691
750
- MUST reject the invoice if `invoice_amount` is not present.
692
751
- MUST reject the invoice if `invoice_created_at` is not present.
693
-
- MUST reject the invoice if `invoice_payment_hash` is not present.
752
+
- if keysend was not supported in `invreq_features`:
753
+
- MUST reject the invoice if `invoice_payment_hash` is not present.
694
754
- MUST reject the invoice if `invoice_node_id` is not present.
695
755
- if `invoice_features` contains unknown _odd_ bits that are non-zero:
696
756
- MUST ignore the bit.
@@ -706,8 +766,9 @@ A reader of an invoice:
706
766
- For each `invoice_blindedpay`.`payinfo`:
707
767
- MUST NOT use the corresponding `invoice_paths`.`path` if `payinfo`.`features` has any unknown even bits set.
708
768
- MUST reject the invoice if this leaves no usable paths.
709
-
- if the invoice is a response to an `invoice_request`:
769
+
- if `invoice_payment_hash` is set and the invoice is a response to an `invoice_request`:
710
770
- MUST reject the invoice if all fields less than type 160 do not exactly match the `invoice_request`.
771
+
- else if the invoice is a response to an `invoice_request`:
711
772
- if `offer_node_id` is present (invoice_request for an offer):
712
773
- MUST reject the invoice if `invoice_node_id` is not equal to `offer_node_id`.
713
774
- otherwise (invoice_request without an offer):
@@ -727,6 +788,9 @@ A reader of an invoice:
727
788
- MUST ignore any `fallback_address` for which `version` is greater than 16.
728
789
- MUST ignore any `fallback_address` for which `address` is less than 2 or greater than 40 bytes.
729
790
- MUST ignore any `fallback_address` for which `address` does not meet known requirements for the given `version`
791
+
- if `invoice_payment_hash` is unset:
792
+
- MUST pay asynchronously using the `held_htlc_available` onion message
793
+
flow, where the onion message is sent over `invoice_message_paths`
0 commit comments