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

Function param_secrets_array

common/json_param.c:659–686  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657}
658
659struct command_result *param_secrets_array(struct command *cmd,
660 const char *name, const char *buffer,
661 const jsmntok_t *tok,
662 struct secret **secrets)
663{
664 size_t i;
665 const jsmntok_t *s;
666 struct secret secret;
667
668 if (tok->type != JSMN_ARRAY) {
669 return command_fail_badparam(cmd, name, buffer, tok,
670 "should be an array of secrets");
671 }
672
673 *secrets = tal_arr(cmd, struct secret, 0);
674 json_for_each_arr(i, s, tok) {
675 if (!hex_decode(buffer + s->start, s->end - s->start, &secret,
676 sizeof(secret)))
677 return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
678 "'%s[%zu]' should be a 32 byte hex "
679 "value, not '%.*s'",
680 name, i, s->end - s->start,
681 buffer + s->start);
682
683 tal_arr_expand(secrets, secret);
684 }
685 return NULL;
686}
687
688/**
689 * segwit_addr_net_decode - Try to decode a Bech32 address and detect

Callers

nothing calls this directly

Calls 3

command_fail_badparamFunction · 0.85
hex_decodeFunction · 0.85
command_failFunction · 0.50

Tested by

no test coverage detected