From 9036d7c2567798d3d29769dfa2de5e076246708c Mon Sep 17 00:00:00 2001 From: Antoine Riard Date: Mon, 5 Jun 2023 00:49:45 +0100 Subject: [PATCH] Specify max HTLC nLocktime for expiry_too_far --- 04-onion-routing.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/04-onion-routing.md b/04-onion-routing.md index 1b5146bf4..e4a970e21 100644 --- a/04-onion-routing.md +++ b/04-onion-routing.md @@ -62,6 +62,7 @@ A node: * [Returning Errors](#returning-errors) * [Failure Messages](#failure-messages) * [Receiving Failure Codes](#receiving-failure-codes) + * [`max_htlc_cltv` Selection](#max-htlc-cltv-selection) * [Test Vector](#test-vector) * [Returning Errors](#returning-errors) * [References](#references) @@ -1325,7 +1326,7 @@ A _forwarding node_ MAY, but a _final node_ MUST NOT: - report the `cltv_expiry` of the outgoing HTLC and the current channel setting for the outgoing channel. - return an `incorrect_cltv_expiry` error. - - if the `cltv_expiry` is unreasonably near the present: + - if the `cltv_expiry` is more than `max_htlc_cltv` near the present: - report the current channel setting for the outgoing channel. - return an `expiry_too_soon` error. - if the `cltv_expiry` is unreasonably far in the future: @@ -1407,6 +1408,13 @@ The _origin node_: - MAY use the data specified in the various failure types for debugging purposes. +## `max_htlc_cltv` Selection + +If the HTLC expires too far in the future, a forwarding node can return an `expiry_too_far` error. + +This `max_htlc_ctlv` value is defined by default to be 2016 blocks, based on historical default +deployed by Lightning implementations. + # Test Vector ## Returning Errors