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

Function param_secrets_array

common/json_param.c:760–787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758}
759
760struct command_result *param_secrets_array(struct command *cmd,
761 const char *name, const char *buffer,
762 const jsmntok_t *tok,
763 struct secret **secrets)
764{
765 size_t i;
766 const jsmntok_t *s;
767 struct secret secret;
768
769 if (tok->type != JSMN_ARRAY) {
770 return command_fail_badparam(cmd, name, buffer, tok,
771 "should be an array of secrets");
772 }
773
774 *secrets = tal_arr(cmd, struct secret, 0);
775 json_for_each_arr(i, s, tok) {
776 if (!hex_decode(buffer + s->start, s->end - s->start, &secret,
777 sizeof(secret)))
778 return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
779 "'%s[%zu]' should be a 32 byte hex "
780 "value, not '%.*s'",
781 name, i, s->end - s->start,
782 buffer + s->start);
783
784 tal_arr_expand(secrets, secret);
785 }
786 return NULL;
787}
788
789/**
790 * segwit_addr_net_decode - Try to decode a Bech32(m) address and detect

Callers

nothing calls this directly

Calls 3

hex_decodeFunction · 0.85
command_fail_badparamFunction · 0.70
command_failFunction · 0.50

Tested by

no test coverage detected