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

Function param_routehint_array

common/json_param.c:1067–1095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1065}
1066
1067struct command_result *
1068param_routehint_array(struct command *cmd, const char *name, const char *buffer,
1069 const jsmntok_t *tok, struct route_info ***ris)
1070{
1071 size_t i;
1072 const jsmntok_t *curr;
1073 char *element_name;
1074 struct command_result *err;
1075 if (tok->type != JSMN_ARRAY) {
1076 return command_fail(
1077 cmd, JSONRPC2_INVALID_PARAMS,
1078 "Routehint array %s (\"%s\") is not an array",
1079 name, json_strdup(tmpctx, buffer, tok));
1080 }
1081
1082 *ris = tal_arr(cmd, struct route_info *, 0);
1083 json_for_each_arr(i, curr, tok) {
1084 struct route_info *element;
1085 element_name = tal_fmt(cmd, "%s[%zu]", name, i);
1086 err = param_routehint(cmd, element_name, buffer, curr, &element);
1087 if (err != NULL) {
1088 return err;
1089 }
1090 tal_arr_expand(ris, element);
1091
1092 tal_free(element_name);
1093 }
1094 return NULL;
1095}
1096
1097struct command_result *param_route_exclusion(struct command *cmd,
1098 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
command_failFunction · 0.50
json_strdupFunction · 0.50

Tested by

no test coverage detected