From 2d95ed738e8f252845249ec4e42e2be205d7a600 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 15 Jun 2018 15:35:55 +0200 Subject: [PATCH] pay: Use `locktime_max` as maximum cumulative CLTV delta Proposed by @rustyrussell. Fixes #1586 Signed-off-by: Christian Decker --- lightningd/options.c | 6 +++--- lightningd/payalgo.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lightningd/options.c b/lightningd/options.c index 5076e779d..6acc05768 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -322,7 +322,7 @@ static void config_register_opts(struct lightningd *ld) &ld->config.locktime_blocks, opt_hidden); opt_register_arg("--max-locktime-blocks", opt_set_u32, opt_show_u32, &ld->config.locktime_max, - "Maximum blocks a peer can lock up our funds"); + "Maximum blocks funds may be locked for"); opt_register_arg("--funding-confirms", opt_set_u32, opt_show_u32, &ld->config.anchor_confirms, "Confirmations required for funding transaction"); @@ -487,7 +487,7 @@ static const struct config testnet_config = { /* They can have up to 14 days, maximumu value that lnd will ask for by default. */ /* FIXME Convince lnd to use more reasonable defaults... */ - .locktime_max = 14 * 6 * 24, + .locktime_max = 14 * 24 * 6, /* We're fairly trusting, under normal circumstances. */ .anchor_confirms = 1, @@ -538,7 +538,7 @@ static const struct config mainnet_config = { /* They can have up to 14 days, maximumu value that lnd will ask for by default. */ /* FIXME Convince lnd to use more reasonable defaults... */ - .locktime_max = 14 * 6 * 24, + .locktime_max = 14 * 24 * 6, /* We're fairly trusting, under normal circumstances. */ .anchor_confirms = 3, diff --git a/lightningd/payalgo.c b/lightningd/payalgo.c index ede917e1b..076fa7868 100644 --- a/lightningd/payalgo.c +++ b/lightningd/payalgo.c @@ -602,7 +602,7 @@ static void json_pay(struct command *cmd, struct bolt11 *b11; char *fail, *b11str, *desc; unsigned int retryfor = 60; - unsigned int maxdelay = 500; + unsigned int maxdelay = cmd->ld->config.locktime_max; if (!json_get_params(cmd, buffer, params, "bolt11", &bolt11tok,