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

Function param_rune

lightningd/runes.c:225–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223};
224
225static struct command_result *param_rune(struct command *cmd, const char *name,
226 const char * buffer, const jsmntok_t *tok,
227 struct rune_and_string **rune_and_string)
228{
229 u64 uid;
230
231 if (tok->end - tok->start > MAX_RUNE_LEN)
232 return command_fail_badparam(cmd, name, buffer, tok,
233 "is too long");
234
235 *rune_and_string = tal(cmd, struct rune_and_string);
236 (*rune_and_string)->runestr = json_strdup(*rune_and_string, buffer, tok);
237 (*rune_and_string)->rune = rune_from_base64(cmd, (*rune_and_string)->runestr);
238 if (!(*rune_and_string)->rune)
239 return command_fail_badparam(cmd, name, buffer, tok,
240 "should be base64 string");
241 /* We always create runes with integer unique ids: accept no less! */
242 if (!unique_id_num((*rune_and_string)->rune, &uid))
243 return command_fail_badparam(cmd, name, buffer, tok,
244 "should have valid numeric unique_id");
245
246 return NULL;
247}
248
249static struct command_result *param_params(struct command *cmd, const char *name,
250 const char * buffer, const jsmntok_t *tok,

Callers

nothing calls this directly

Calls 4

rune_from_base64Function · 0.85
unique_id_numFunction · 0.85
command_fail_badparamFunction · 0.50
json_strdupFunction · 0.50

Tested by

no test coverage detected