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