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

Function param_layer_names

plugins/askrene/askrene.c:135–181  ·  view source on GitHub ↗

Valid, known layers */

Source from the content-addressed store, hash-verified

133
134/* Valid, known layers */
135static struct command_result *param_layer_names(struct command *cmd,
136 const char *name,
137 const char *buffer,
138 const jsmntok_t *tok,
139 const char ***arr)
140{
141 size_t i;
142 const jsmntok_t *t;
143
144 if (tok->type != JSMN_ARRAY)
145 return command_fail_badparam(cmd, name, buffer, tok,
146 "should be an array");
147
148 *arr = tal_arr(cmd, const char *, tok->size);
149 json_for_each_arr(i, t, tok) {
150 if (t->type != JSMN_STRING)
151 return command_fail_badparam(cmd, name, buffer, t,
152 "should be a string");
153 (*arr)[i] = json_strdup(*arr, buffer, t);
154
155 if (is_maxhops((*arr)[i])) {
156 u32 v;
157 if (!parse_maxhops((*arr)[i], &v))
158 return command_fail_badparam(
159 cmd, name, buffer, t,
160 "maxhops must be a u32");
161 continue;
162 }
163
164 /* Must be a known layer name */
165 if (streq((*arr)[i], "auto.localchans")
166 || streq((*arr)[i], "auto.sourcefree")
167 || streq((*arr)[i], "auto.include_fees"))
168 continue;
169
170 if (streq((*arr)[i], "auto.no_mpp_support")
171 && command_deprecated_in_ok(cmd, "layers.auto.no_mpp_support",
172 "v26.06", "v27.03"))
173 continue;
174
175 if (!find_layer(get_askrene(cmd->plugin), (*arr)[i])) {
176 return command_fail_badparam(cmd, name, buffer, t,
177 "unknown layer");
178 }
179 }
180 return NULL;
181}
182
183static struct command_result *param_known_layer(struct command *cmd,
184 const char *name,

Callers

nothing calls this directly

Calls 7

is_maxhopsFunction · 0.85
parse_maxhopsFunction · 0.85
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