1
0
mirror of https://github.com/lightning/bolts.git synced 2024-11-19 01:50:03 +01:00

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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-07-11 10:26:13 +09:30
parent 8abd9c7e26
commit bc1ce064d2
2 changed files with 8 additions and 4 deletions

View File

@ -2040,8 +2040,11 @@ A receiving node:
- if other `id` violations occur:
- MAY send a `warning` and close the connection, or send an
`error` and fail the channel.
- if `blinding_point` is provided:
- MUST use the corresponding blinded private key to decrypt the `onion_routing_packet` (see [Route Blinding](04-onion-routing.md#route-blinding))
- 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`.
- If decryption fails, the result is not a valid `payload` TLV, or it contains unknown even types:
- MUST respond with an error as detailed in [Failure Messages](04-onion-routing.md#failure-messages)
- Otherwise:
- MUST follow the requirements for the reader of `payload` in [Payload Format](04-onion-routing.md#payload-format)
The `onion_routing_packet` contains an obfuscated list of hops and instructions for each hop along the path.
It commits to the HTLC by setting the `payment_hash` as associated data, i.e. includes the `payment_hash` in the computation of HMACs.

View File

@ -1523,8 +1523,9 @@ The reader:
- SHOULD accept onion messages from peers without an established channel.
- MAY rate-limit messages by dropping them.
- MUST read the `encrypted_recipient_data` using `blinding` as required in [Route Blinding](#route-blinding).
- MUST ignore the message if that considers the message invalid.
- 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`.
- If decryption fails, the result is not a valid `onionmsg_tlv`, or it contains unknown even types:
- MUST ignore the message.
- if `encrypted_data_tlv` contains `allowed_features`:
- MUST ignore the message if:
- `encrypted_data_tlv.allowed_features.features` contains an unknown feature bit (even if it is odd).