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
Copy file name to clipboardexpand all lines: 12-offer-encoding.md
+30-30
Original file line number
Diff line number
Diff line change
@@ -314,12 +314,12 @@ A reader of an offer:
314
314
from that estimate.
315
315
- if the current time is after `offer_absolute_expiry`:
316
316
- MUST NOT respond to the offer.
317
-
- if it chooses to send an `invoice_request`, it sends an onion message:
317
+
- if it chooses to send an invoice request, it sends an onion message:
318
318
- if `offer_paths` is set:
319
319
- MUST send the onion message via any path in `offer_paths` to the final `onion_msg_hop`.`blinded_node_id` in that path
320
320
- otherwise:
321
321
- MUST send the onion message to `offer_issuer_id`
322
-
- MAY send more than one `invoice_request` onion message at once.
322
+
- MAY send more than one invoice request onion message at once.
323
323
324
324
## Rationale
325
325
@@ -340,7 +340,7 @@ fields.
340
340
341
341
The `offer_issuer_id` can be omitted for brevity, if `offer_paths` is set, as each of the final `blinded_node_id` in the paths can serve as a valid public key for the destination.
342
342
343
-
Because `offer_amount` can be in a different currency (using the `offer_currency` field) it is merely a guide: the issuer will convert it into a number of millisatoshis for `invoice_amount` at the time they generate an invoice, or the `invoice_request` can specify the exact amount in `invreq_amount`, but the issuer may then reject it if it disagrees.
343
+
Because `offer_amount` can be in a different currency (using the `offer_currency` field) it is merely a guide: the issuer will convert it into a number of millisatoshis for `invoice_amount` at the time they generate an invoice, or the invoice request can specify the exact amount in `invreq_amount`, but the issuer may then reject it if it disagrees.
344
344
345
345
`offer_quantity_max` is allowed to be 1, which seems useless, but
346
346
useful in a system which bases it on available stock. It would be
@@ -363,7 +363,7 @@ message: if it's valid and refers to a known offer, the response is
363
363
generally to reply with an `invoice` using the `reply_path` field of
364
364
the onion message.
365
365
366
-
The second case is publishing an `invoice_request` without an offer,
366
+
The second case is publishing an invoice request without an offer,
367
367
such as via QR code. It contains neither `offer_issuer_id` nor `offer_paths`, setting the
368
368
`invreq_payer_id` (and possibly `invreq_paths`) instead, as it in the one paying: the
369
369
other offer fields are filled by the creator of the `invoice_request`,
@@ -483,53 +483,53 @@ The writer:
483
483
- MUST set `invreq_features`.`features` to the bitmap of features.
484
484
485
485
The reader:
486
-
- MUST fail the request if `invreq_payer_id` or `invreq_metadata` are not present.
487
-
- MUST fail the request if any non-signature TLV fields are outside the inclusive ranges: 0 to 159 and 1000000000 to 2999999999
486
+
- MUST reject the invoice request if `invreq_payer_id` or `invreq_metadata` are not present.
487
+
- MUST reject the invoice request if any non-signature TLV fields are outside the inclusive ranges: 0 to 159 and 1000000000 to 2999999999
488
488
- if `invreq_features` contains unknown _odd_ bits that are non-zero:
489
489
- MUST ignore the bit.
490
490
- if `invreq_features` contains unknown _even_ bits that are non-zero:
491
-
- MUST fail the request.
492
-
- MUST fail the request if `signature` is not correct as detailed in [Signature Calculation](#signature-calculation) using the `invreq_payer_id`.
491
+
- MUST reject the invoice request.
492
+
- MUST reject the invoice request if `signature` is not correct as detailed in [Signature Calculation](#signature-calculation) using the `invreq_payer_id`.
493
493
- if `num_hops` is 0 in any `blinded_path` in `invreq_paths`:
494
-
- MUST fail the request.
494
+
- MUST reject the invoice request.
495
495
- if `offer_issuer_id` is present, and `invreq_metadata` is identical to a previous `invoice_request`:
496
496
- MAY simply reply with the previous invoice.
497
497
- otherwise:
498
498
- MUST NOT reply with a previous invoice.
499
499
- if `offer_issuer_id` or `offer_paths` are present (response to an offer):
500
-
- MUST fail the request if the offer fields do not exactly match a valid, unexpired offer.
500
+
- MUST reject the invoice request if the offer fields do not exactly match a valid, unexpired offer.
501
501
- if `offer_paths` is present:
502
502
- MUST ignore the invoice_request if it did not arrive via one of those paths.
503
503
- otherwise:
504
504
- MUST ignore any invoice_request if it arrived via a blinded path.
505
505
- if `offer_quantity_max` is present:
506
-
- MUST fail the request if there is no `invreq_quantity` field.
506
+
- MUST reject the invoice request if there is no `invreq_quantity` field.
507
507
- if `offer_quantity_max` is non-zero:
508
-
- MUST fail the request if `invreq_quantity` is zero, OR greater than `offer_quantity_max`.
508
+
- MUST reject the invoice request if `invreq_quantity` is zero, OR greater than `offer_quantity_max`.
509
509
- otherwise:
510
-
- MUST fail the request if there is an `invreq_quantity` field.
510
+
- MUST reject the invoice request if there is an `invreq_quantity` field.
511
511
- if `offer_amount` is present:
512
512
- MUST calculate the *expected amount* using the `offer_amount`:
513
513
- if `offer_currency` is not the `invreq_chain` currency, convert to the
514
514
`invreq_chain` currency.
515
515
- if `invreq_quantity` is present, multiply by `invreq_quantity`.`quantity`.
516
516
- if `invreq_amount` is present:
517
-
- MUST fail the request if `invreq_amount`.`msat` is less than the *expected amount*.
518
-
- MAY fail the request if `invreq_amount`.`msat` greatly exceeds the *expected amount*.
517
+
- MUST reject the invoice request if `invreq_amount`.`msat` is less than the *expected amount*.
518
+
- MAY reject the invoice request if `invreq_amount`.`msat` greatly exceeds the *expected amount*.
519
519
- otherwise (no `offer_amount`):
520
-
- MUST fail the request if it does not contain `invreq_amount`.
520
+
- MUST reject the invoice request if it does not contain `invreq_amount`.
521
521
- SHOULD send an invoice in response using the `onionmsg_tlv``reply_path`.
522
522
- otherwise (no `offer_issuer_id` or `offer_paths`, not a response to our offer):
523
-
- MUST fail the request if any of the following are present:
523
+
- MUST reject the invoice request if any of the following are present:
524
524
-`offer_chains`, `offer_features` or `offer_quantity_max`.
525
-
- MUST fail the request if `invreq_amount` is not present.
525
+
- MUST reject the invoice request if `invreq_amount` is not present.
526
526
- MAY use `offer_amount` (or `offer_currency`) for informational display to user.
527
527
- if it sends an invoice in response:
528
528
- MUST use `invreq_paths` if present, otherwise MUST use `invreq_payer_id` as the node id to send to.
529
529
- if `invreq_chain` is not present:
530
-
- MUST fail the request if bitcoin is not a supported chain.
530
+
- MUST reject the invoice request if bitcoin is not a supported chain.
531
531
- otherwise:
532
-
- MUST fail the request if `invreq_chain`.`chain` is not a supported chain.
532
+
- MUST reject the invoice request if `invreq_chain`.`chain` is not a supported chain.
533
533
534
534
535
535
## Rationale
@@ -551,7 +551,7 @@ the invoice request amount exceeds the amount it's expecting (i.e. its
551
551
`offer_amount` after any currency conversion, multiplied by `invreq_quantity`, if
552
552
any).
553
553
554
-
Non-offer-response `invoice_request`s are currently required to
554
+
Non-offer-response invoice requests are currently required to
555
555
explicitly state the `invreq_amount` in the chain currency,
556
556
so `offer_amount` and `offer_currency` are redundant (but may be
557
557
informative for the payer to know how the sender claims
@@ -695,7 +695,7 @@ A writer of an invoice:
695
695
the minimal lightning-payable unit (e.g. milli-satoshis for bitcoin) for
696
696
`invreq_chain`.
697
697
- if the invoice is in response to an `invoice_request`:
698
-
- MUST copy all non-signature fields from the `invoice_request` (including unknown fields).
698
+
- MUST copy all non-signature fields from the invoice request (including unknown fields).
699
699
- if `invreq_amount` is present:
700
700
- MUST set `invoice_amount` to `invreq_amount`
701
701
- otherwise:
@@ -705,7 +705,7 @@ A writer of an invoice:
705
705
- if `offer_issuer_id` is present:
706
706
- MUST set `invoice_node_id` to the `offer_issuer_id`
707
707
- otherwise, if `offer_paths` is present:
708
-
- MUST set `invoice_node_id` to the final `blinded_node_id` on the path it received the `invoice_request`
708
+
- MUST set `invoice_node_id` to the final `blinded_node_id` on the path it received the invoice request
709
709
- MUST specify exactly one signature TLV element: `signature`.
710
710
- MUST set `sig` to the signature using `invoice_node_id` as described in [Signature Calculation](#signature-calculation).
711
711
- if it requires multiple parts to pay the invoice:
@@ -734,9 +734,9 @@ A reader of an invoice:
734
734
- MUST reject the invoice if `invoice_payment_hash` is not present.
735
735
- MUST reject the invoice if `invoice_node_id` is not present.
736
736
- if `invreq_chain` is not present:
737
-
- MUST fail the request if bitcoin is not a supported chain.
737
+
- MUST reject the invoice if bitcoin is not a supported chain.
738
738
- otherwise:
739
-
- MUST fail the request if `invreq_chain`.`chain` is not a supported chain.
739
+
- MUST reject the invoice if `invreq_chain`.`chain` is not a supported chain.
740
740
- if `invoice_features` contains unknown _odd_ bits that are non-zero:
741
741
- MUST ignore the bit.
742
742
- if `invoice_features` contains unknown _even_ bits that are non-zero:
@@ -753,11 +753,11 @@ A reader of an invoice:
753
753
- MUST NOT use the corresponding `invoice_paths`.`path` if `payinfo`.`features` has any unknown even bits set.
754
754
- MUST reject the invoice if this leaves no usable paths.
755
755
- if the invoice is a response to an `invoice_request`:
756
-
- MUST reject the invoice if all fields in ranges 0 to 159 and 1000000000 to 2999999999 (inclusive) do not exactly match the `invoice_request`.
756
+
- MUST reject the invoice if all fields in ranges 0 to 159 and 1000000000 to 2999999999 (inclusive) do not exactly match the invoice request.
757
757
- if `offer_issuer_id` is present (invoice_request for an offer):
758
758
- MUST reject the invoice if `invoice_node_id` is not equal to `offer_issuer_id`
759
759
- otherwise, if `offer_paths` is present (invoice_request for an offer without id):
760
-
- MUST reject the invoice if `invoice_node_id` is not equal to the final `blinded_node_id` it sent the `invoice_request` to.
760
+
- MUST reject the invoice if `invoice_node_id` is not equal to the final `blinded_node_id` it sent the invoice request to.
761
761
- otherwise (invoice_request without an offer):
762
762
- MAY reject the invoice if it cannot confirm that `invoice_node_id` is correct, out-of-band.
763
763
- MUST reject the invoice if `signature` is not a valid signature using `invoice_node_id` as described in [Signature Calculation](#signature-calculation).
@@ -777,11 +777,11 @@ A reader of an invoice:
777
777
- MUST ignore any `fallback_address` for which `address` is less than 2 or greater than 40 bytes.
778
778
- MUST ignore any `fallback_address` for which `address` does not meet known requirements for the given `version`
779
779
- if `invreq_paths` is present:
780
-
- MUST ignore the invoice if it did not arrive via one of those paths.
780
+
- MUST reject the invoice if it did not arrive via one of those paths.
781
781
- otherwise, neither `offer_issuer_id` nor `offer_paths` are present (not derived from an offer):
782
-
- MUST ignore any invoice if it arrived via a blinded path.
782
+
- MUST reject the invoice if it arrived via a blinded path.
783
783
- otherwise (derived from an offer):
784
-
- MUST ignore the invoice if it did not arrive via invoice request `onionmsg_tlv``reply_path`.
784
+
- MUST reject the invoice if it did not arrive via invoice request `onionmsg_tlv``reply_path`.
0 commit comments