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

Function createinvoice_error

plugins/offers_invreq_hook.c:212–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212static struct command_result *createinvoice_error(struct command *cmd,
213 const char *method,
214 const char *buf,
215 const jsmntok_t *err,
216 struct invreq *ir)
217{
218 u32 code;
219 const char *status;
220
221 /* If it already exists, we can reuse its bolt12 directly. */
222 if (json_scan(tmpctx, buf, err,
223 "{code:%,data:{status:%}}",
224 JSON_SCAN(json_to_u32, &code),
225 JSON_SCAN_TAL(tmpctx, json_strdup, &status)) == NULL
226 && code == INVOICE_LABEL_ALREADY_EXISTS) {
227 if (streq(status, "unpaid"))
228 return createinvoice_done(cmd, method, buf,
229 json_get_member(buf, err, "data"), ir);
230 if (streq(status, "expired"))
231 return fail_invreq(cmd, ir, "invoice expired (cancelled?)");
232 }
233 return error(cmd, method, buf, err, ir);
234}
235
236static struct command_result *create_invoicereq(struct command *cmd,
237 struct invreq *ir)

Callers

nothing calls this directly

Calls 4

json_get_memberFunction · 0.85
createinvoice_doneFunction · 0.70
errorFunction · 0.70
json_scanFunction · 0.50

Tested by

no test coverage detected