common: allow configvars to be marked dynamic.

To test, we do min-capacity-sat which is simple.  We also update the
listconfigs man page which contained some obsolete information.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-06-05 23:48:21 +09:30
parent 9f9f2f1493
commit aca893f1eb
5 changed files with 36 additions and 5 deletions

View File

@@ -143,6 +143,8 @@ static void json_add_config(struct lightningd *ld,
json_add_bool(response, "set", cv != NULL);
json_add_source(response, "source", cv);
json_add_config_plugin(response, ld->plugins, "plugin", ot);
if (ot->type & OPT_DYNAMIC)
json_add_bool(response, "dynamic", true);
json_object_end(response);
return;
}
@@ -167,6 +169,8 @@ static void json_add_config(struct lightningd *ld,
}
json_array_end(response);
json_add_config_plugin(response, ld->plugins, "plugin", ot);
if (ot->type & OPT_DYNAMIC)
json_add_bool(response, "dynamic", true);
json_object_end(response);
return;
}
@@ -180,6 +184,8 @@ static void json_add_config(struct lightningd *ld,
json_add_configval(response, configval_fieldname(ot), ot, val);
json_add_source(response, "source", cv);
json_add_config_plugin(response, ld->plugins, "plugin", ot);
if (ot->type & OPT_DYNAMIC)
json_add_bool(response, "dynamic", true);
json_object_end(response);
}

View File

@@ -1352,7 +1352,7 @@ static void register_opts(struct lightningd *ld)
opt_set_msat,
opt_show_msat, &ld->config.max_dust_htlc_exposure_msat,
"Max HTLC amount that can be trimmed");
clnopt_witharg("--min-capacity-sat", OPT_SHOWINT, opt_set_u64, opt_show_u64,
clnopt_witharg("--min-capacity-sat", OPT_SHOWINT|OPT_DYNAMIC, opt_set_u64, opt_show_u64,
&ld->config.min_capacity_sat,
"Minimum capacity in satoshis for accepting channels");
clnopt_witharg("--addr", OPT_MULTI, opt_add_addr, NULL,