bolts icon indicating copy to clipboard operation
bolts copied to clipboard

BOLT4: unclear handling of invalid onions at final node

Open f321x opened this issue 4 months ago • 2 comments

In BOLT 4 it is written that only forwarding nodes, but not final nodes, should fail an htlc e.g. for an invalid hmac or onion version. Why should the final node not fail a htlc with these errors if they receive an invalid onion? Should final nodes use some different error type or is this an issue of the spec?

https://github.com/lightning/bolts/blob/14272b1bd9361750cfdb3e5d35740889a6b510b5/04-onion-routing.md?plain=1#L1333-L1339

f321x avatar Sep 10 '25 14:09 f321x

You're right, I think that those requirements shouldn't be in that section: AFAIK all implementations today do send those errors even when they're the final node.

t-bast avatar Sep 17 '25 07:09 t-bast

i think only the first 3 should be moved to another section.

The others in that section contain errors that the second-to-last node can/should send, but the final node shouldn't. Some examples:

  - if the receiving peer specified by the onion is NOT known:
    - return an `unknown_next_peer` error.
  - if the HTLC amount is less than the currently specified minimum amount:
    - report the amount of the outgoing HTLC and the current channel setting for
    the outgoing channel.
    - return an `amount_below_minimum` error.
  - if the HTLC does NOT pay a sufficient fee:
    - report the amount of the incoming HTLC and the current channel setting for
    the outgoing channel.
    - return a `fee_insufficient` error.

All of these can be sent by the penultimate node, but it doesn't make sense for the destination to send them.

Roasbeef avatar Sep 18 '25 00:09 Roasbeef