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

Function json_decodepay

lightningd/invoice.c:1586–1612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1584AUTODATA(json_command, &waitinvoice_command);
1585
1586static struct command_result *json_decodepay(struct command *cmd,
1587 const char *buffer,
1588 const jsmntok_t *obj UNNEEDED,
1589 const jsmntok_t *params)
1590{
1591 struct bolt11 *b11;
1592 struct json_stream *response;
1593 const char *str, *desc;
1594 char *fail;
1595
1596 if (!param(cmd, buffer, params,
1597 p_req("bolt11", param_string, &str),
1598 p_opt("description", param_string, &desc),
1599 NULL))
1600 return command_param_failed();
1601
1602 b11 = bolt11_decode(cmd, str, cmd->ld->our_features, desc, NULL,
1603 &fail);
1604
1605 if (!b11) {
1606 return command_fail(cmd, LIGHTNINGD, "Invalid bolt11: %s", fail);
1607 }
1608
1609 response = json_stream_success(cmd);
1610 json_add_bolt11(response, b11);
1611 return command_success(cmd, response);
1612}
1613
1614static const struct json_command decodepay_command = {
1615 "decodepay",

Callers

nothing calls this directly

Calls 7

command_param_failedFunction · 0.70
command_failFunction · 0.70
json_stream_successFunction · 0.70
command_successFunction · 0.70
paramFunction · 0.50
bolt11_decodeFunction · 0.50
json_add_bolt11Function · 0.50

Tested by

no test coverage detected