Skip to content

Commit

Permalink
options: be more conservative with timeouts on mainnet.
Browse files Browse the repository at this point in the history
As per lightning/bolts#785

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Changed: config: the default CLTV expiry is now 34 blocks, and final expiry 18 blocks as per new BOLT recommendations.
  • Loading branch information
rustyrussell committed Aug 24, 2020
1 parent 6e4e267 commit b09e519
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CCANDIR := ccan

# Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/
BOLTVERSION := c053ce7afb4cbf88615877a0d5fc7b8dbe2b9ba0
BOLTVERSION := 886bf7a430db706b483b7b02d64a82bf175c0b46

-include config.vars

Expand Down
8 changes: 4 additions & 4 deletions lightningd/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,16 +639,16 @@ static const struct config mainnet_config = {
/* BOLT #2:
*
* 1. the `cltv_expiry_delta` for channels, `3R+2G+2S`: if in doubt, a
* `cltv_expiry_delta` of 12 is reasonable (R=2, G=1, S=2)
* `cltv_expiry_delta` of at least 34 is reasonable (R=2, G=2, S=12)
*/
/* R = 2, G = 1, S = 3 */
.cltv_expiry_delta = 14,
/* R = 2, G = 2, S = 12 */
.cltv_expiry_delta = 34,

/* BOLT #2:
*
* 4. the minimum `cltv_expiry` accepted for terminal payments: the
* worst case for the terminal node C is `2R+G+S` blocks */
.cltv_final = 10,
.cltv_final = 18,

/* Send commit 10msec after receiving; almost immediately. */
.commit_time_ms = 10,
Expand Down
4 changes: 2 additions & 2 deletions lightningd/peer_htlcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2278,7 +2278,7 @@ void free_htlcs(struct lightningd *ld, const struct channel *channel)
*
* 2. the deadline for offered HTLCs: the deadline after which the channel has
* to be failed and timed out on-chain. This is `G` blocks after the HTLC's
* `cltv_expiry`: 1 block is reasonable.
* `cltv_expiry`: 1 or 2 blocks is reasonable.
*/
static u32 htlc_out_deadline(const struct htlc_out *hout)
{
Expand All @@ -2290,7 +2290,7 @@ static u32 htlc_out_deadline(const struct htlc_out *hout)
* 3. the deadline for received HTLCs this node has fulfilled: the deadline
* after which the channel has to be failed and the HTLC fulfilled on-chain
* before its `cltv_expiry`. See steps 4-7 above, which imply a deadline of
* `2R+G+S` blocks before `cltv_expiry`: 7 blocks is reasonable.
* `2R+G+S` blocks before `cltv_expiry`: 18 blocks is reasonable.
*/
/* We approximate this, by using half the cltv_expiry_delta (3R+2G+2S),
* rounded up. */
Expand Down

0 comments on commit b09e519

Please sign in to comment.