plugins: don't try to fetch max-locktime-blocks.
What changed, and why it matters
This commit removes leftover code that tried to read a configuration option called 'max-locktime-blocks' from three payment-related plugins. That option was already removed from the core software, so the code was doing nothing useful. The commit also hardcodes the fallback maximum payment delay to 2016 blocks, which was already the previous default. There is no direct security fix here; it is mostly cleanup of dead code.
No security action required. Treat as routine cleanup. If reviewing related code, verify that maxdelay user overrides are still honored and that 2016 blocks remains an appropriate default.
Security signals we found
Removal of dead configuration fallback code
No change to effective maxdelay default (remains 2016 blocks)
No bounds, type, or validation changes
No memory safety, auth, or crypto changes
Evidence from the diff
The patch deletes rpc_scan calls in keysend.c, pay.c, and renepay/main.c that attempted to fetch the deprecated/removed ‘max-locktime-blocks’ config value. It removes the static maxdelay_default variables in keysend.c and pay.c, and instead passes the literal 2016 block default directly to p_opt_def. In renepay/main.c it simply removes the unused rpc_scan. The behavior is unchanged because 2016 was already the default and the config key no longer exists.
Changed components
plugins/keysend.cplugins/pay.cplugins/renepay/main.cInspect captured patch +16 / −39
diff --git a/plugins/keysend.c b/plugins/keysend.c
index 56b3b368..6c02dc8f 100644
--- a/plugins/keysend.c
+++ b/plugins/keysend.c
@@ -15,7 +15,6 @@
#define PREIMAGE_TLV_TYPE 5482373484
#define KEYSEND_FEATUREBIT 55
-static unsigned int maxdelay_default;
static struct node_id my_id;
static u64 *accepted_extra_tlvs;
static struct channel_hint_set *global_hints;
@@ -140,20 +139,9 @@ static const char *init(struct command *init_cmd, const char *buf UNUSED,
global_hints = notleak_with_children(channel_hint_set_new(init_cmd->plugin));
accepted_extra_tlvs = notleak(tal_arr(NULL, u64, 0));
- /* BOLT #4:
- * ## `max_htlc_cltv` Selection
- *
- * This ... value is defined as 2016 blocks, based on historical value
- * deployed by Lightning implementations.
- */
- /* FIXME: Typo in spec for CLTV in descripton! But it breaks our spelling check, so we omit it above */
- maxdelay_default = 2016;
- /* max-locktime-blocks deprecated in v24.05, but still grab it! */
rpc_scan(init_cmd, "listconfigs", take(json_out_obj(NULL, NULL, NULL)),
"{configs:{"
- "max-locktime-blocks?:{value_int:%},"
"accept-htlc-tlv-type:{values_int:%}}}",
- JSON_SCAN(json_to_u32, &maxdelay_default),
JSON_SCAN(jsonarr_accumulate_u64, &accepted_extra_tlvs));
return NULL;
@@ -203,6 +191,13 @@ static struct command_result *json_keysend(struct command *cmd, const char *buf,
bool *dev_use_shadow;
struct out_req *req;
+ /* BOLT #4:
+ * ## `max_htlc_cltv` Selection
+ *
+ * This ... value is defined as 2016 blocks, based on historical value
+ * deployed by Lightning implementations.
+ */
+ /* FIXME: Typo in spec for CLTV in descripton! But it breaks our spelling check, so we omit it above */
if (!param_check(cmd, buf, params,
p_req("destination", param_node_id, &destination),
p_req("amount_msat", param_msat, &msat),
@@ -210,8 +205,7 @@ static struct command_result *json_keysend(struct command *cmd, const char *buf,
p_opt("maxfeepercent", param_millionths,
&maxfee_pct_millionths),
p_opt_def("retry_for", param_number, &retryfor, 60),
- p_opt_def("maxdelay", param_number, &maxdelay,
- maxdelay_default),
+ p_opt_def("maxdelay", param_number, &maxdelay, 2016),
p_opt("exemptfee", param_msat, &exemptfee),
p_opt("extratlvs", param_extra_tlvs, &extra_fields),
p_opt("routehints", param_routehint_array, &hints),
diff --git a/plugins/pay.c b/plugins/pay.c
index a0ef430a..fae675f1 100644
--- a/plugins/pay.c
+++ b/plugins/pay.c
@@ -15,7 +15,6 @@
/* Public key of this node. */
static struct node_id my_id;
-static unsigned int maxdelay_default;
static bool disablempp = false;
static struct channel_hint_set *global_hints;
@@ -627,23 +626,8 @@ static const char *init(struct command *init_cmd,
rpc_scan(init_cmd, "getinfo", take(json_out_obj(NULL, NULL, NULL)),
"{id:%}", JSON_SCAN(json_to_node_id, &my_id));
- /* BOLT #4:
- * ## `max_htlc_cltv` Selection
- *
- * This ... value is defined as 2016 blocks, based on historical value
- * deployed by Lightning implementations.
- */
- /* FIXME: Typo in spec for CLTV in descripton! But it breaks our spelling check, so we omit it above */
- maxdelay_default = 2016;
-
global_hints = notleak_with_children(channel_hint_set_new(init_cmd->plugin));
- /* max-locktime-blocks deprecated in v24.05, but still grab it! */
- rpc_scan(init_cmd, "listconfigs", take(json_out_obj(NULL, NULL, NULL)),
- "{configs:"
- "{max-locktime-blocks?:{value_int:%}}}",
- JSON_SCAN(json_to_number, &maxdelay_default));
-
plugin_set_memleak_handler(init_cmd->plugin, memleak_mark_payments);
return NULL;
}
@@ -1294,6 +1278,13 @@ static struct command_result *json_pay(struct command *cmd,
/* If any of the modifiers need to add params to the JSON-RPC call we
* would add them to the `param()` call below, and have them be
* initialized directly that way. */
+ /* BOLT #4:
+ * ## `max_htlc_cltv` Selection
+ *
+ * This ... value is defined as 2016 blocks, based on historical value
+ * deployed by Lightning implementations.
+ */
+ /* FIXME: Typo in spec for CLTV in descripton! But it breaks our spelling check, so we omit it above */
if (!param_check(cmd, buf, params,
/* FIXME: parameter should be invstring now */
p_req("bolt11", param_invstring, &b11str),
@@ -1305,7 +1296,7 @@ static struct command_result *json_pay(struct command *cmd,
&maxfee_pct_millionths),
p_opt_def("retry_for", param_number, &retryfor, 60),
p_opt_def("maxdelay", param_number, &maxdelay,
- maxdelay_default),
+ 2016),
p_opt("exemptfee", param_msat, &exemptfee),
p_opt("localinvreqid", param_sha256, &local_invreq_id),
p_opt("exclude", param_route_exclusion_array, &exclusions),
diff --git a/plugins/renepay/main.c b/plugins/renepay/main.c
index 21790f26..e1a47313 100644
--- a/plugins/renepay/main.c
+++ b/plugins/renepay/main.c
@@ -59,14 +59,6 @@ static const char *init(struct command *init_cmd,
*/
/* FIXME: Typo in spec for CLTV in descripton! But it breaks our spelling check, so we omit it above */
pay_plugin->maxdelay_default = 2016;
- /* max-locktime-blocks deprecated in v24.05, but still grab it! */
- rpc_scan(init_cmd, "listconfigs",
- take(json_out_obj(NULL, NULL, NULL)),
- "{configs:"
- "{max-locktime-blocks?:{value_int:%}}}",
- JSON_SCAN(json_to_number, &pay_plugin->maxdelay_default)
- );
-
pay_plugin->payment_map = tal(pay_plugin, struct payment_map);
payment_map_init(pay_plugin->payment_map);
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.