| 1584 | AUTODATA(json_command, &waitinvoice_command); |
| 1585 | |
| 1586 | static 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 | |
| 1614 | static const struct json_command decodepay_command = { |
| 1615 | "decodepay", |
nothing calls this directly
no test coverage detected