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

Function param_restrictions

lightningd/runes.c:535–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

533}
534
535static struct command_result *param_restrictions(struct command *cmd,
536 const char *name,
537 const char *buffer,
538 const jsmntok_t *tok,
539 struct rune_restr ***restrs)
540{
541 if (json_tok_streq(buffer, tok, "readonly"))
542 *restrs = readonly_restrictions(cmd);
543 else if (tok->type == JSMN_ARRAY) {
544 size_t i;
545 const jsmntok_t *t;
546
547 *restrs = tal_arr(cmd, struct rune_restr *, tok->size);
548 json_for_each_arr(i, t, tok) {
549 (*restrs)[i] = rune_restr_from_json(cmd, *restrs, buffer, t);
550 if (!(*restrs)[i]) {
551 return command_fail_badparam(cmd, name, buffer, t,
552 "not a valid restriction (should be array)");
553 }
554 }
555 } else {
556 *restrs = tal_arr(cmd, struct rune_restr *, 1);
557 (*restrs)[0] = rune_restr_from_json(cmd, *restrs, buffer, tok);
558 if (!(*restrs)[0])
559 return command_fail_badparam(cmd, name, buffer, tok,
560 "not a valid restriction (should be array)");
561 }
562 return NULL;
563}
564
565static struct command_result *reply_with_rune(struct command *cmd,
566 const char *buf UNUSED,

Callers

nothing calls this directly

Calls 4

json_tok_streqFunction · 0.85
readonly_restrictionsFunction · 0.85
rune_restr_from_jsonFunction · 0.85
command_fail_badparamFunction · 0.50

Tested by

no test coverage detected