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

Function parse_reserve_hop

plugins/askrene/askrene.c:152–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152static struct command_result *parse_reserve_hop(struct command *cmd,
153 const char *name,
154 const char *buffer,
155 const jsmntok_t *tok,
156 struct reserve_hop *rhop)
157{
158 const char *err;
159 const char *layername = NULL;
160
161 err = json_scan(tmpctx, buffer, tok, "{short_channel_id_dir:%,amount_msat:%,layer?:%}",
162 JSON_SCAN(json_to_short_channel_id_dir, &rhop->scidd),
163 JSON_SCAN(json_to_msat, &rhop->amount),
164 JSON_SCAN_TAL(tmpctx, json_strdup, &layername));
165 if (err)
166 return command_fail_badparam(cmd, name, buffer, tok, err);
167 if (layername) {
168 rhop->layer = find_layer(get_askrene(cmd->plugin), layername);
169 if (!rhop->layer)
170 return command_fail_badparam(cmd, name, buffer, tok, "Unknown layer");
171 } else
172 rhop->layer = NULL;
173
174 return NULL;
175}
176
177static struct command_result *param_reserve_path(struct command *cmd,
178 const char *name,

Callers 1

param_reserve_pathFunction · 0.85

Calls 4

find_layerFunction · 0.85
get_askreneFunction · 0.85
json_scanFunction · 0.50
command_fail_badparamFunction · 0.50

Tested by

no test coverage detected