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

Function check_result

plugins/offers_offer.c:211–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209};
210
211static struct command_result *check_result(struct command *cmd,
212 const char *method,
213 const char *buf,
214 const jsmntok_t *result,
215 void *arg UNNEEDED)
216{
217 bool active;
218
219 /* If it's inactive, we can't return it, */
220 if (!json_to_bool(buf, json_get_member(buf, result, "active"),
221 &active)) {
222 return command_fail(cmd,
223 LIGHTNINGD,
224 "Bad createoffer/createinvoicerequest status reply %.*s",
225 json_tok_full_len(result),
226 json_tok_full(buf, result));
227 }
228 if (!active)
229 return command_fail(cmd,
230 OFFER_ALREADY_EXISTS,
231 "Already exists, but isn't active");
232
233 /* Otherwise, push through the result. */
234 return forward_result(cmd, method, buf, result, arg);
235}
236
237static struct command_result *create_offer(struct command *cmd,
238 struct offer_info *offinfo)

Callers

nothing calls this directly

Calls 6

json_get_memberFunction · 0.85
forward_resultFunction · 0.85
command_failFunction · 0.70
json_to_boolFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50

Tested by

no test coverage detected