1
0
Fork 0
mirror of https://github.com/lightning/bolts.git synced 2025-03-10 09:10:07 +01:00

Allow unset onion_hash in invalid_onion_blinding (#1093)

In most cases the `onion_hash` isn't actionable in the case of blinded
payments and it's wasteful to keep track of the incoming onion, so we
allow setting it to an all zero value.
This commit is contained in:
Bastien Teinturier 2023-07-27 11:31:40 +02:00 committed by GitHub
parent 7f53a3e46e
commit 7d3ef5a6b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1144,14 +1144,16 @@ A node:
- When failing an incoming HTLC: - When failing an incoming HTLC:
- If `current_blinding_point` is set in the onion payload and it is not the - If `current_blinding_point` is set in the onion payload and it is not the
final node: final node:
- MUST send an `update_fail_htlc` error using the - MUST send an `update_fail_htlc` error using the `invalid_onion_blinding`
`invalid_onion_blinding` failure code with the `sha256_of_onion` failure code for any local or downstream errors.
of the onion it received, for any local or downstream errors. - SHOULD use the `sha256_of_onion` of the onion it received.
- MAY use an all zero `sha256_of_onion`.
- SHOULD add a random delay before sending `update_fail_htlc`. - SHOULD add a random delay before sending `update_fail_htlc`.
- If `blinding_point` is set in the incoming `update_add_htlc`: - If `blinding_point` is set in the incoming `update_add_htlc`:
- MUST send an `update_fail_malformed_htlc` error using the - MUST send an `update_fail_malformed_htlc` error using the
`invalid_onion_blinding` failure code with the `sha256_of_onion` `invalid_onion_blinding` failure code for any local or downstream errors.
of the onion it received, for any local or downstream errors. - SHOULD use the `sha256_of_onion` of the onion it received.
- MAY use an all zero `sha256_of_onion`.
A receiving node: A receiving node:
- if the `id` does not correspond to an HTLC in its current commitment transaction: - if the `id` does not correspond to an HTLC in its current commitment transaction:
@ -1166,7 +1168,7 @@ A receiving node:
- MUST send a `warning` and close the connection, or send an - MUST send a `warning` and close the connection, or send an
`error` and fail the channel. `error` and fail the channel.
- if the `sha256_of_onion` in `update_fail_malformed_htlc` doesn't match the - if the `sha256_of_onion` in `update_fail_malformed_htlc` doesn't match the
onion it sent: onion it sent and is not all zero:
- MAY retry or choose an alternate error response. - MAY retry or choose an alternate error response.
- otherwise, a receiving node which has an outgoing HTLC canceled by `update_fail_malformed_htlc`: - otherwise, a receiving node which has an outgoing HTLC canceled by `update_fail_malformed_htlc`:
- MUST return an error in the `update_fail_htlc` sent to the link which - MUST return an error in the `update_fail_htlc` sent to the link which