Skip to content

Commit 819c657

Browse files
committed
Add payment metadata to payment request
1 parent c876dac commit 819c657

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

04-onion-routing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ It is formatted according to the Type-Length-Value format defined in [BOLT #1](0
263263
2. data:
264264
* [`32*byte`:`payment_secret`]
265265
* [`tu64`:`total_msat`]
266+
1. type: 10 (`payment_metadata`)
267+
2. data:
268+
* [`len*byte`:`payment_metadata`]
266269

267270
### Requirements
268271

11-payment-encoding.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ Currently defined tagged fields are:
140140
* `p` (1): `data_length` 52. 256-bit SHA256 payment_hash. Preimage of this provides proof of payment.
141141
* `s` (16): `data_length` 52. This 256-bit secret prevents forwarding nodes from probing the payment recipient.
142142
* `d` (13): `data_length` variable. Short description of purpose of payment (UTF-8), e.g. '1 cup of coffee' or 'ナンセンス 1杯'
143+
* `m` (14): `data_length` variable. Additional metadata to attach to the
144+
payment.
143145
* `n` (19): `data_length` 53. 33-byte public key of the payee node
144146
* `h` (23): `data_length` 52. 256-bit description of purpose of payment (SHA256). This is used to commit to an associated description that is over 639 bytes, but the transport mechanism for the description in that case is transport specific and not defined here.
145147
* `x` (6): `data_length` variable. `expiry` time in seconds (big-endian). Default is 3600 (1 hour) if not specified.
@@ -216,6 +218,8 @@ A reader:
216218
- MUST use that as [`payment_secret`](04-onion-routing.md#tlv_payload-payload-format)
217219
- if the `c` field (`min_final_cltv_expiry`) is not provided:
218220
- MUST use an expiry delta of at least 18 when making the payment
221+
- if the `m` field is provided, it MUST send the contents of this field in the
222+
final hop payload as tlv field 10.
219223

220224
### Rationale
221225

@@ -235,6 +239,9 @@ by which the description is served is as-yet unspecified and will
235239
probably be transport dependent. The `h` format could change in the future,
236240
by changing the length, so readers ignore it if it's not 256 bits.
237241

242+
The `m` field allows metadata to be attached to the payment. This supports
243+
spontaneous payments and other applications where the recipient doesn't keep any context for the payment.
244+
238245
The `n` field can be used to explicitly specify the destination node ID,
239246
instead of requiring signature recovery.
240247

0 commit comments

Comments
 (0)