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

Function param_layer_names

plugins/askrene/askrene.c:95–132  ·  view source on GitHub ↗

Valid, known layers */

Source from the content-addressed store, hash-verified

93
94/* Valid, known layers */
95static struct command_result *param_layer_names(struct command *cmd,
96 const char *name,
97 const char *buffer,
98 const jsmntok_t *tok,
99 const char ***arr)
100{
101 size_t i;
102 const jsmntok_t *t;
103
104 if (tok->type != JSMN_ARRAY)
105 return command_fail_badparam(cmd, name, buffer, tok,
106 "should be an array");
107
108 *arr = tal_arr(cmd, const char *, tok->size);
109 json_for_each_arr(i, t, tok) {
110 if (t->type != JSMN_STRING)
111 return command_fail_badparam(cmd, name, buffer, t,
112 "should be a string");
113 (*arr)[i] = json_strdup(*arr, buffer, t);
114
115 /* Must be a known layer name */
116 if (streq((*arr)[i], "auto.localchans")
117 || streq((*arr)[i], "auto.sourcefree")
118 || streq((*arr)[i], "auto.include_fees"))
119 continue;
120
121 if (streq((*arr)[i], "auto.no_mpp_support")
122 && command_deprecated_in_ok(cmd, "layers.auto.no_mpp_support",
123 "v26.06", "v27.03"))
124 continue;
125
126 if (!find_layer(get_askrene(cmd->plugin), (*arr)[i])) {
127 return command_fail_badparam(cmd, name, buffer, t,
128 "unknown layer");
129 }
130 }
131 return NULL;
132}
133
134static struct command_result *param_known_layer(struct command *cmd,
135 const char *name,

Callers

nothing calls this directly

Calls 5

find_layerFunction · 0.85
get_askreneFunction · 0.85
command_fail_badparamFunction · 0.50
json_strdupFunction · 0.50
command_deprecated_in_okFunction · 0.50

Tested by

no test coverage detected