Skip to content

Commit

Permalink
BOLT 2,4: allow an error for HTLCs which expire too far away. (bitcoi…
Browse files Browse the repository at this point in the history
…n#265)

Fixes: bitcoin#261

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Oct 31, 2017
1 parent 58d4d9b commit c93cd75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions 02-peer-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ to an outgoing HTLC, until the removal of the outgoing HTLC is irrevocably commi

A node MUST fail an incoming HTLC (`update_fail_htlc`) once its `cltv_expiry` has been reached, or if `cltv_expiry` - `current_height` < `cltv_expiry_delta` for the outgoing channel.

A node SHOULD fail an incoming HTLC (`update_fail_htlc`) if its `cltv_expiry` is unreasonably far in the future.

A node MUST fulfill an incoming HTLC for which it has committed to an outgoing HTLC,
as soon as it receives `update_fulfill_htlc` for the outgoing HTLC, or has discovered the `payment_preimage` from an on-chain HTLC spend.

Expand All @@ -519,6 +521,9 @@ In general, we need to complete one side of the exchange before dealing with the
Fulfilling an HTLC is different: knowledge of the preimage is by definition irrevocable,
so we should fulfill the incoming HTLC as soon as we can to reduce latency.

An HTLC with an extremely long expiry is a denial-of-service vector,
so it is not allowed: the exact value of "unreasonable" is currently unclear
and may depend on network topology.

### `cltv_expiry_delta` Selection

Expand Down
4 changes: 4 additions & 0 deletions 04-onion-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,10 @@ setting for the outgoing channel:
* [`2`:`len`]
* [`len`:`channel_update`]

If the `cltv_expiry` is unreasonably far, we can also report an error:

1. type: 21 (`expiry_too_far`)

If the channel is disabled, we tell them the the current channel
setting for the outgoing channel:

Expand Down

0 comments on commit c93cd75

Please sign in to comment.