Browse Source

lightningd/plugin: fix the "plugins" entry in 'listconfigs'

The value 'as_int' should not be added as a bool.
travis-debug
darosior 5 years ago
committed by Christian Decker
parent
commit
87f0733965
  1. 7
      lightningd/plugin.c

7
lightningd/plugin.c

@ -1127,19 +1127,18 @@ void json_add_opt_plugins(struct json_stream *response,
/* FIXME: use executables basename until plugins can define their names */
plugin_name = path_basename(NULL, p->cmd);
json_add_string(response, "name", plugin_name); // basename(p->cmd));
json_add_string(response, "name", plugin_name);
tal_free(plugin_name);
if (!list_empty(&p->plugin_opts)) {
json_object_start(response, "options");
list_for_each(&p->plugin_opts, opt, list)
{
list_for_each(&p->plugin_opts, opt, list) {
/* Trim the `--` that we added before */
opt_name = opt->name + 2;
if (opt->value->as_bool) {
json_add_bool(response, opt_name, opt->value->as_bool);
} else if (opt->value->as_int) {
json_add_bool(response, opt_name, opt->value->as_int);
json_add_s32(response, opt_name, *opt->value->as_int);
} else if (opt->value->as_str) {
json_add_string(response, opt_name, opt->value->as_str);
} else {

Loading…
Cancel
Save