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

Function createinvoice_done

plugins/fetchinvoice.c:1379–1414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1377}
1378
1379static struct command_result *createinvoice_done(struct command *cmd,
1380 const char *buf,
1381 const jsmntok_t *result,
1382 struct sent *sent)
1383{
1384 const jsmntok_t *invtok = json_get_member(buf, result, "bolt12");
1385 char *fail;
1386 enum nodeid_parity parity;
1387
1388 /* Replace invoice with signed one */
1389 tal_free(sent->inv);
1390 sent->inv = invoice_decode(sent,
1391 buf + invtok->start,
1392 invtok->end - invtok->start,
1393 plugin_feature_set(cmd->plugin),
1394 chainparams,
1395 &fail);
1396 if (!sent->inv) {
1397 plugin_log(cmd->plugin, LOG_BROKEN,
1398 "Bad createinvoice %.*s: %s",
1399 json_tok_full_len(invtok),
1400 json_tok_full(buf, invtok),
1401 fail);
1402 return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
1403 "Bad createinvoice response %s", fail);
1404 }
1405
1406 sent->path = path_to_node(sent, cmd->plugin,
1407 sent->offer->node_id,
1408 &parity);
1409 if (!sent->path)
1410 return connect_direct(cmd, sent->offer->node_id, parity,
1411 sendinvoice_after_connect, sent);
1412
1413 return sendinvoice_after_connect(cmd, NULL, NULL, sent);
1414}
1415
1416static struct command_result *sign_invoice(struct command *cmd,
1417 struct sent *sent)

Callers

nothing calls this directly

Calls 11

tal_freeFunction · 0.85
plugin_feature_setFunction · 0.85
path_to_nodeFunction · 0.85
connect_directFunction · 0.85
plugin_logFunction · 0.70
command_failFunction · 0.70
json_get_memberFunction · 0.50
invoice_decodeFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50

Tested by

no test coverage detected