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

Function param_routehint_array

common/json_param.c:949–977  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

947}
948
949struct command_result *
950param_routehint_array(struct command *cmd, const char *name, const char *buffer,
951 const jsmntok_t *tok, struct route_info ***ris)
952{
953 size_t i;
954 const jsmntok_t *curr;
955 char *element_name;
956 struct command_result *err;
957 if (tok->type != JSMN_ARRAY) {
958 return command_fail(
959 cmd, JSONRPC2_INVALID_PARAMS,
960 "Routehint array %s (\"%s\") is not an array",
961 name, json_strdup(tmpctx, buffer, tok));
962 }
963
964 *ris = tal_arr(cmd, struct route_info *, 0);
965 json_for_each_arr(i, curr, tok) {
966 struct route_info *element;
967 element_name = tal_fmt(cmd, "%s[%zu]", name, i);
968 err = param_routehint(cmd, element_name, buffer, curr, &element);
969 if (err != NULL) {
970 return err;
971 }
972 tal_arr_expand(ris, element);
973
974 tal_free(element_name);
975 }
976 return NULL;
977}
978
979struct command_result *param_route_exclusion(struct command *cmd,
980 const char *name, const char *buffer, const jsmntok_t *tok,

Callers

nothing calls this directly

Calls 4

param_routehintFunction · 0.85
tal_freeFunction · 0.85
json_strdupFunction · 0.70
command_failFunction · 0.50

Tested by

no test coverage detected