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

Function bip353_fetched

plugins/xpay/xpay.c:2265–2300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2263}
2264
2265static struct command_result *
2266bip353_fetched(struct command *cmd,
2267 const char *method,
2268 const char *buf,
2269 const jsmntok_t *result,
2270 struct xpay_params *xparams)
2271{
2272 const jsmntok_t *instructions, *t, *offertok;
2273 const char *offerstr;
2274 struct command_result *ret;
2275 size_t i;
2276
2277 instructions = json_get_member(buf, result, "instructions");
2278 json_for_each_arr(i, t, instructions) {
2279 offertok = json_get_member(buf, t, "offer");
2280 if (offertok)
2281 break;
2282 }
2283
2284 if (!offertok)
2285 return command_fail(cmd, PAY_UNSPECIFIED_ERROR,
2286 "BIP353 response did not contain an offer (%.*s)",
2287 json_tok_full_len(result),
2288 json_tok_full(buf, result));
2289 offerstr = json_strdup(tmpctx, buf, offertok);
2290
2291 if (xparams->includefees_msat)
2292 ret = check_offer_sendamount_payable(cmd, offerstr);
2293 else
2294 ret = check_offer_payable(cmd, offerstr, xparams->msat);
2295
2296 if (ret)
2297 return ret;
2298
2299 return do_fetchinvoice(cmd, offerstr, xparams);
2300}
2301
2302static struct command_result *json_xpay_params(struct command *cmd,
2303 const char *buffer,

Callers

nothing calls this directly

Calls 8

json_get_memberFunction · 0.85
check_offer_payableFunction · 0.85
do_fetchinvoiceFunction · 0.85
command_failFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50
json_strdupFunction · 0.50

Tested by

no test coverage detected