From 6974c58b474e89ce271a31470740045e4ce9a7c4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 15 Jan 2019 14:51:27 +1030 Subject: [PATCH] plugins/pay: get max-locktime-blocks at init for setting default. Signed-off-by: Rusty Russell --- plugins/pay.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/pay.c b/plugins/pay.c index 3469a7b2d..f402e59be 100644 --- a/plugins/pay.c +++ b/plugins/pay.c @@ -8,6 +8,7 @@ /* Public key of this node. */ static struct pubkey my_id; +static unsigned int maxdelay_default; struct pay_attempt { const char *route; @@ -282,8 +283,7 @@ static struct command_result *handle_pay(struct command *cmd, p_opt_def("maxfeepercent", param_percent, &maxfeepercent, 0.5), p_opt_def("retry_for", param_number, &retryfor, 60), p_opt_def("maxdelay", param_number, &maxdelay, - /* FIXME! */ - 14 * 24 * 6), + maxdelay_default), p_opt_def("exemptfee", param_u64, &exemptfee, 5000), NULL)) return NULL; @@ -335,6 +335,11 @@ static void init(struct plugin_conn *rpc) field = rpc_delve(tmpctx, "getinfo", "", rpc, ".id"); if (!pubkey_from_hexstr(field, strlen(field), &my_id)) plugin_err("getinfo didn't contain valid id: '%s'", field); + + field = rpc_delve(tmpctx, "listconfigs", + "'config': 'max-locktime-blocks'", + rpc, ".max-locktime-blocks"); + maxdelay_default = atoi(field); } static const struct plugin_command commands[] = { {