| 1708 | AUTODATA(json_command, &waitsendpay_command); |
| 1709 | |
| 1710 | static struct command_result * |
| 1711 | injectonion_fail(struct command *cmd, |
| 1712 | const struct wallet_payment *payment, |
| 1713 | enum jsonrpc_errcode pay_errcode, |
| 1714 | const struct onionreply *onionreply, |
| 1715 | const struct routing_failure *fail, |
| 1716 | const char *errmsg, |
| 1717 | struct secret *shared_secret) |
| 1718 | { |
| 1719 | struct json_stream *js; |
| 1720 | |
| 1721 | /* Turn local errors into onion reply. */ |
| 1722 | if (!onionreply) { |
| 1723 | const u8 *err; |
| 1724 | |
| 1725 | /* Local error with no context, use default error */ |
| 1726 | if (fail->msg) |
| 1727 | err = fail->msg; |
| 1728 | else |
| 1729 | err = towire_temporary_channel_failure(tmpctx, NULL); |
| 1730 | |
| 1731 | onionreply = create_onionreply(tmpctx, shared_secret, err); |
| 1732 | } |
| 1733 | |
| 1734 | js = json_stream_fail(cmd, PAY_INJECTPAYMENTONION_FAILED, errmsg); |
| 1735 | /* We wrap the onion reply, as it expects. */ |
| 1736 | json_add_hex_talarr(js, "onionreply", |
| 1737 | wrap_onionreply(tmpctx, shared_secret, onionreply) |
| 1738 | ->contents); |
| 1739 | |
| 1740 | json_object_end(js); |
| 1741 | return command_failed(cmd, js); |
| 1742 | } |
| 1743 | |
| 1744 | static struct command_result * |
| 1745 | injectonion_succeed(struct command *cmd, |
nothing calls this directly
no test coverage detected