Skip to content

Commit f78b5bf

Browse files
committed
resolve p field ambiguity and add signature disclaimer
1 parent e1fa25c commit f78b5bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

11-payment-encoding.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ A writer:
207207
A reader:
208208
- MUST skip over unknown fields, OR an `f` field with unknown `version`, OR `p`, `h`, `s` or
209209
`n` fields that do NOT have `data_length`s of 52, 52, 52 or 53, respectively.
210+
- MUST fail the payment if a mandatory field (`p` or `s`) was skipped due to an incorrect
211+
length.
212+
- MUST fail the payment if a `d` field is not present and a `h` field was skipped due to an
213+
incorrect length.
210214
- if the `9` field contains unknown _odd_ bits that are non-zero:
211215
- MUST ignore the bit.
212216
- if the `9` field contains unknown _even_ bits that are non-zero:
@@ -222,6 +226,7 @@ A reader:
222226
- MUST use an expiry delta of at least 18 when making the payment
223227
- if an `m` field is provided:
224228
- MUST use that as [`payment_metadata`](04-onion-routing.md#tlv_payload-payload-format)
229+
225230
### Rationale
226231

227232
The type-and-length format allows future extensions to be backward
@@ -357,6 +362,7 @@ https://github.com/rustyrussell/lightning-payencode
357362

358363
NB: all the following examples are signed with `priv_key`=`e126f68f7eafcc8b74f54d269fe206be715000f94dac067d1c04a8ca3b2db734`.
359364
All invoices contain a `payment_secret`=`1111111111111111111111111111111111111111111111111111111111111111` unless otherwise noted.
365+
Signatures are deterministic and generated using RFC6979 (using HMAC-SHA256). Note that even though using a `low R` would save 1 byte in the DER-encoded signature (by avoiding the need for a leading zero byte when the most significant bit is set), it is not enforced in this specification.
360366

361367
> ### Please make a donation of any amount using payment_hash 0001020304050607080900010203040506070809000102030405060708090102 to me @03e7156ae33b0a208d0744199163177e909e80176e55d97a2f221ede0f934dd9ad
362368
> lnbc1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq9qrsgq357wnc5r2ueh7ck6q93dj32dlqnls087fxdwk8qakdyafkq3yap9us6v52vjjsrvywa6rt52cm9r9zqt8r2t7mlcwspyetp5h2tztugp9lfyql

0 commit comments

Comments
 (0)