Skip to content

Commit bc1ce06

Browse files
committed
BOLT 2, BOLT 4: refer to the onion decryption section in update_add_htlc/onion message requirements.
This ties it together, saying what to use as associated data, blinding, and what to do on failure. Signed-off-by: Rusty Russell <[email protected]>
1 parent 8abd9c7 commit bc1ce06

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

02-peer-protocol.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,8 +2040,11 @@ A receiving node:
20402040
- if other `id` violations occur:
20412041
- MAY send a `warning` and close the connection, or send an
20422042
`error` and fail the channel.
2043-
- if `blinding_point` is provided:
2044-
- MUST use the corresponding blinded private key to decrypt the `onion_routing_packet` (see [Route Blinding](04-onion-routing.md#route-blinding))
2043+
- MUST decrypt `onion_routing_packet` with `associated_data` set to `payment_hash`, and using `blinding` (if present) as described in [Onion Decryption](04-onion-routing.md#onion-decryption) to extract a `payload`.
2044+
- If decryption fails, the result is not a valid `payload` TLV, or it contains unknown even types:
2045+
- MUST respond with an error as detailed in [Failure Messages](04-onion-routing.md#failure-messages)
2046+
- Otherwise:
2047+
- MUST follow the requirements for the reader of `payload` in [Payload Format](04-onion-routing.md#payload-format)
20452048

20462049
The `onion_routing_packet` contains an obfuscated list of hops and instructions for each hop along the path.
20472050
It commits to the HTLC by setting the `payment_hash` as associated data, i.e. includes the `payment_hash` in the computation of HMACs.

04-onion-routing.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,8 +1523,9 @@ The reader:
15231523

15241524
- SHOULD accept onion messages from peers without an established channel.
15251525
- MAY rate-limit messages by dropping them.
1526-
- MUST read the `encrypted_recipient_data` using `blinding` as required in [Route Blinding](#route-blinding).
1527-
- MUST ignore the message if that considers the message invalid.
1526+
- MUST decrypt `onion_message_packet` using an empty `associated_data`, and `blinding`, as described in [Onion Decryption](04-onion-routing.md#onion-decryption) to extract an `onionmsg_tlv`.
1527+
- If decryption fails, the result is not a valid `onionmsg_tlv`, or it contains unknown even types:
1528+
- MUST ignore the message.
15281529
- if `encrypted_data_tlv` contains `allowed_features`:
15291530
- MUST ignore the message if:
15301531
- `encrypted_data_tlv.allowed_features.features` contains an unknown feature bit (even if it is odd).

0 commit comments

Comments
 (0)