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

Function fail_exists

lightningd/invoice.c:1623–1641  ·  view source on GitHub ↗

If we fail because it exists, we also return the clashing invoice */

Source from the content-addressed store, hash-verified

1621
1622/* If we fail because it exists, we also return the clashing invoice */
1623static struct command_result *fail_exists(struct command *cmd,
1624 const struct json_escape *label)
1625{
1626 struct json_stream *data;
1627 struct invoice invoice;
1628 struct wallet *wallet = cmd->ld->wallet;
1629
1630 data = json_stream_fail(cmd, INVOICE_LABEL_ALREADY_EXISTS,
1631 "Duplicate label");
1632 if (!wallet_invoice_find_by_label(wallet, &invoice, label))
1633 fatal("Duplicate invoice %s not found any more?",
1634 label->s);
1635
1636 json_add_invoice_fields(data,
1637 wallet_invoice_details(cmd, wallet, invoice));
1638 json_object_end(data);
1639
1640 return command_failed(cmd, data);
1641}
1642
1643static struct command_result *json_createinvoice(struct command *cmd,
1644 const char *buffer,

Callers 1

json_createinvoiceFunction · 0.85

Calls 7

json_add_invoice_fieldsFunction · 0.85
json_stream_failFunction · 0.70
fatalFunction · 0.70
command_failedFunction · 0.70
wallet_invoice_detailsFunction · 0.50
json_object_endFunction · 0.50

Tested by

no test coverage detected