Browse Source

options: be more conservative with timeouts on mainnet.

As per https://github.com/lightningnetwork/lightning-rfc/pull/785

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: config: the default CLTV expiry is now 34 blocks, and final expiry 18 blocks as per new BOLT recommendations.
bump-pyln-proto
Rusty Russell 4 years ago
parent
commit
b09e519669
  1. 2
      Makefile
  2. 8
      lightningd/options.c
  3. 4
      lightningd/peer_htlcs.c

2
Makefile

@ -24,7 +24,7 @@ CCANDIR := ccan
# Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/
BOLTVERSION := c053ce7afb4cbf88615877a0d5fc7b8dbe2b9ba0
BOLTVERSION := 886bf7a430db706b483b7b02d64a82bf175c0b46
-include config.vars

8
lightningd/options.c

@ -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,

4
lightningd/peer_htlcs.c

@ -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)
{
@ -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. */

Loading…
Cancel
Save