Skip to content

Commit 10f0c5b

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 keysend invoice on their behalf.
1 parent 6b585c2 commit 10f0c5b

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

04-onion-routing.md

Lines changed: 11 additions & 3 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,9 +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-
`keysend_payment_preimage` is the payment preimage provided by the sender in the
246-
case that the recipient is often-offline and another node provided a keysend
247-
BOLT 12 invoice on their behalf.
248+
In the case that the recipient is often-offline and another node provided a
249+
keysend BOLT 12 invoice on their behalf:
250+
* `keysend_payment_preimage` is the payment preimage provided by the sender
251+
* `invoice_request` is the sender's invoice request corresponding to this HTLC.
248252

249253
### Requirements
250254

@@ -280,6 +284,10 @@ The writer of the TLV `payload`:
280284
- MUST set `keysend_payment_preimage` to randomly generated unique bytes.
281285
- MUST set `update_add_htlc.payment_hash` to match the SHA256 hash of
282286
`keysend_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
283291
- otherwise:
284292
- MUST NOT set `keysend_payment_preimage`.
285293
- MUST NOT include any other tlv field.

12-offer-encoding.md

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

680680
## Invoice Features
681681

682-
| Bits | Description | Name |
683-
|------|----------------------------------|----------------|
684-
| 16 | Multi-part-payment support | MPP/compulsory |
685-
| 17 | Multi-part-payment support | MPP/optional |
682+
| Bits | Description | Name |
683+
|------|--------------------------------------------|---------------------------------|
684+
| 0 | Include `invoice_request` in payment onion | payment_onion_invreq/compulsory |
685+
| 1 | Include `invoice_request` in payment onion | payment_onion_invreq/optional |
686+
| 16 | Multi-part-payment support | MPP/compulsory |
687+
| 17 | Multi-part-payment support | MPP/optional |
688+
689+
The `payment_onion_invreq` feature indicates that the payer MUST (0) or MAY (1)
690+
repeat their invoice request in the `update_add_htlc` payment onion.
691+
692+
Often-offline receivers may not have received the payer's invoice request
693+
originally if another node replied with a keysend invoice on their behalf.
694+
Providing it to the receiver separately may be useful for verification purposes
695+
or to supply some other data relevant to the payment.
686696

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

0 commit comments

Comments
 (0)