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

Function check_result

plugins/offers_offer.c:216–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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