Skip to content

Commit dc6599f

Browse files
Support repeating an invoice_request in payment onions.
This field may be useful for often-offline recipients who did not receive the invreq when it was originally sent, due to another node providing a static invoice on their behalf. Recipients may want to verify the invreq or be provided some other relevant data about the payment while remaining stateless until an HTLC is actually received.
1 parent edc93aa commit dc6599f

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

04-onion-routing.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ This is formatted according to the Type-Length-Value format defined in [BOLT #1]
188188

189189
1. `tlv_stream`: `payload`
190190
2. types:
191+
1. type: 1 (`invoice_request`)
192+
2. data:
193+
* [`...*byte`:`invoice_request_tlv_stream`]
191194
1. type: 2 (`amt_to_forward`)
192195
2. data:
193196
* [`tu64`:`amt_to_forward`]
@@ -242,8 +245,10 @@ The requirements ensure consistency in responding to an unexpected
242245
`outgoing_cltv_value`, whether it is the final node or not, to avoid
243246
leaking its position in the route.
244247

245-
`sender_provided_payment_preimage` is set in the case that the recipient is
246-
often-offline and another node provided a static BOLT 12 invoice on their behalf.
248+
`sender_provided_payment_preimage` and `invoice_request` are set in the case
249+
that the recipient is often-offline and another node provided a static BOLT 12
250+
invoice on their behalf, where `invoice_request` is the sender's originl
251+
invoice request corresponding to this HTLC.
247252

248253
### Requirements
249254

@@ -279,6 +284,10 @@ The writer of the TLV `payload`:
279284
- MUST set `sender_provided_payment_preimage` to randomly generated unique bytes.
280285
- MUST set `update_add_htlc.payment_hash` to match the SHA256 hash of
281286
`sender_provided_payment_preimage`.
287+
- if the `payment_onion_invreq` feature is set in the invoice:
288+
- MUST or MAY set `invoice_request` to the BOLT 12 invoice request
289+
corresponding to this HTLC, based on whether `payment_onion_invreq`
290+
is optional or compulsory.
282291
- otherwise:
283292
- MUST NOT set `sender_provided_payment_preimage`.
284293
- MUST NOT include any other tlv field.

09-features.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ The Context column decodes as follows:
2828
* `9`: presented in [BOLT 11](11-payment-encoding.md) invoices.
2929
* `B`: presented in the `allowed_features` field of a blinded path.
3030
* `R`: presented in [BOLT 12](12-offers.md) invoice requests.
31+
* `V`: presented in [BOLT 12](12-offers.md) invoices.
3132

3233
| Bits | Name | Description | Context | Dependencies | Link |
3334
|-------|-----------------------------------|-----------------------------------------------------------|----------|---------------------------|-----------------------------------------------------------------------|
@@ -54,6 +55,7 @@ The Context column decodes as follows:
5455
| 52/53 | `option_htlc_hold` | Hold HTLCs and forward on receipt of an onion message | IN | `option_onion_messages` |
5556
| 56/57 | `option_om_mailbox` | Store-and-forward onion messages for often-offline peers | IN | `option_onion_messages` | [BOLT #12](bolt12-offers.md) |
5657
| 59 | `static_invoice_pay` | Supports paying BOLT 12 static invoices | R | `option_onion_messages` | [BOLT #12](bolt12-offers.md) |
58+
| 60/61 | `payment_onion_invreq` | Include `invoice_request` in payment onion | V | | [BOLT #12](bolt12-offers.md) |
5759

5860
## Definitions
5961

12-offer-encoding.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -670,10 +670,20 @@ the `onion_message` `invoice` field.
670670

671671
## Invoice Features
672672

673-
| Bits | Description | Name |
674-
|------|----------------------------------|----------------|
675-
| 16 | Multi-part-payment support | MPP/compulsory |
676-
| 17 | Multi-part-payment support | MPP/optional |
673+
| Bits | Description | Name |
674+
|------|--------------------------------------------|---------------------------------|
675+
| 16 | Multi-part-payment support | MPP/compulsory |
676+
| 17 | Multi-part-payment support | MPP/optional |
677+
| 60 | Include `invoice_request` in payment onion | payment_onion_invreq/compulsory |
678+
| 61 | Include `invoice_request` in payment onion | payment_onion_invreq/optional |
679+
680+
The `payment_onion_invreq` feature indicates that the payer MUST (0) or MAY (1)
681+
repeat their invoice request in the `update_add_htlc` payment onion.
682+
683+
Often-offline receivers may not have received the payer's invoice request
684+
originally if another node replied with a keysend invoice on their behalf.
685+
Providing it to the receiver separately may be useful for verification purposes
686+
or to supply some other data relevant to the payment.
677687

678688
The 'MPP support' invoice feature indicates that the payer MUST (16) or
679689
MAY (17) use multiple part payments to pay the invoice.

0 commit comments

Comments
 (0)