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

Function injectonion_fail

lightningd/pay.c:1710–1742  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1708AUTODATA(json_command, &waitsendpay_command);
1709
1710static struct command_result *
1711injectonion_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
1744static struct command_result *
1745injectonion_succeed(struct command *cmd,

Callers

nothing calls this directly

Calls 6

create_onionreplyFunction · 0.85
json_add_hex_talarrFunction · 0.85
wrap_onionreplyFunction · 0.85
json_object_endFunction · 0.85
json_stream_failFunction · 0.70
command_failedFunction · 0.70

Tested by

no test coverage detected