MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_listconfigs

Function json_listconfigs

lightningd/configs.c:262–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262static struct command_result *json_listconfigs(struct command *cmd,
263 const char *buffer,
264 const jsmntok_t *obj UNNEEDED,
265 const jsmntok_t *params)
266{
267 struct json_stream *response = NULL;
268 const struct opt_table *config;
269
270 if (!param(cmd, buffer, params,
271 p_opt("config", param_opt_config, &config),
272 NULL))
273 return command_param_failed();
274
275 response = json_stream_success(cmd);
276 json_object_start(response, "configs");
277 for (size_t i = 0; i < opt_count; i++) {
278 const char **names;
279
280 /* FIXME: Print out comment somehow? */
281 if (opt_table[i].type == OPT_SUBTABLE)
282 continue;
283
284 if (config && config != &opt_table[i])
285 continue;
286
287 names = opt_names_arr(tmpctx, &opt_table[i]);
288 /* We don't usually print dev or deprecated options, unless
289 * they explicitly ask, or they're set. */
290 json_add_config(cmd->ld, response, config != NULL, true,
291 &opt_table[i], names);
292 }
293 json_object_end(response);
294
295 return command_success(cmd, response);
296}
297
298static const struct json_command listconfigs_command = {
299 "listconfigs",

Callers

nothing calls this directly

Calls 8

json_object_startFunction · 0.85
opt_names_arrFunction · 0.85
json_add_configFunction · 0.85
json_object_endFunction · 0.85
command_param_failedFunction · 0.70
json_stream_successFunction · 0.70
command_successFunction · 0.70
paramFunction · 0.50

Tested by

no test coverage detected