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

Function createinvoice_done

plugins/offers_invreq_hook.c:167–190  ·  view source on GitHub ↗

We can fail to create the invoice if we've already done so. */

Source from the content-addressed store, hash-verified

165
166/* We can fail to create the invoice if we've already done so. */
167static struct command_result *createinvoice_done(struct command *cmd,
168 const char *buf,
169 const jsmntok_t *result,
170 struct invreq *ir)
171{
172 char *hrp;
173 u8 *rawinv;
174 struct tlv_onionmsg_payload *payload;
175 const jsmntok_t *t;
176
177 /* We have a signed invoice, use it as a reply. */
178 t = json_get_member(buf, result, "bolt12");
179 if (!from_bech32_charset(tmpctx, buf + t->start, t->end - t->start,
180 &hrp, &rawinv)) {
181 return fail_internalerr(cmd, ir,
182 "Bad creatinvoice bolt12 string %.*s",
183 json_tok_full_len(t),
184 json_tok_full(buf, t));
185 }
186
187 payload = tlv_onionmsg_payload_new(tmpctx);
188 payload->invoice = rawinv;
189 return send_onion_reply(cmd, ir->reply_path, payload);
190}
191
192static struct command_result *createinvoice_error(struct command *cmd,
193 const char *buf,

Callers 1

createinvoice_errorFunction · 0.70

Calls 6

send_onion_replyFunction · 0.85
fail_internalerrFunction · 0.70
json_get_memberFunction · 0.50
from_bech32_charsetFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50

Tested by

no test coverage detected