Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop the required channel_update in failure onions #1163

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions 04-onion-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -1080,12 +1080,7 @@ The top byte of `failure_code` can be read as a set of flags:
* 0x8000 (BADONION): unparsable onion encrypted by sending peer
* 0x4000 (PERM): permanent failure (otherwise transient)
* 0x2000 (NODE): node failure (otherwise channel)
* 0x1000 (UPDATE): new channel update enclosed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for this section, it's already optional today, but the spec still states it as being mandatory.


Please note that the `channel_update` field is mandatory in messages whose
`failure_code` includes the `UPDATE` flag. It is encoded *with* the message
type prefix, i.e. it should always start with `0x0102`. Note that historical
lightning implementations serialized this without the `0x0102` message type.
* 0x1000 (UPDATE): channel forwarding parameter was violated

The following `failure_code`s are defined:

Expand Down Expand Up @@ -1378,12 +1373,21 @@ In the case of multiple short_channel_id aliases, the `channel_update`
expecting, to both avoid confusion and to avoid leaking information
about other aliases (or the real location of the channel UTXO).

The `channel_update` field used to be mandatory in messages whose `failure_code`
includes the `UPDATE` flag. However, because nodes applying an update contained
in the onion to their gossip data is a massive fingerprinting vulnerability,
the `channel_update` field is no longer mandatory and nodes are expected to
transition away from including it. Nodes which do not provide a
`channel_update` are expected to set the `channel_update` `len` field to zero.


## Receiving Failure Codes

### Requirements

The _origin node_:
- MUST ignore any extra bytes in `failuremsg`.
- MUST ignore the `channel_update` field.
- if the _final node_ is returning the error:
- if the PERM bit is set:
- SHOULD fail the payment.
Expand All @@ -1397,20 +1401,8 @@ The _origin node_:
- SHOULD remove all channels connected with the erring node from
consideration.
- if the PERM bit is NOT set:
- SHOULD restore the channels as it receives new `channel_update`s.
- otherwise:
- if UPDATE is set, AND the `channel_update` is valid and more recent
than the `channel_update` used to send the payment:
- if `channel_update` should NOT have caused the failure:
- MAY treat the `channel_update` as invalid.
- otherwise:
- SHOULD apply the `channel_update`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be a MAY.

- MAY queue the `channel_update` for broadcast.
Copy link
Collaborator

@Roasbeef Roasbeef Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also remove just this line.

- otherwise:
- SHOULD eliminate the channel outgoing from the erring node from
consideration.
- if the PERM bit is NOT set:
- SHOULD restore the channel as it receives new `channel_update`s.
- SHOULD restore the channels as it receives new `channel_update`s from
its peers.
- SHOULD then retry routing and sending the payment.
- MAY use the data specified in the various failure types for debugging
purposes.
Expand Down