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

Function fail_out_htlc

lightningd/peer_htlcs.c:217–239  ·  view source on GitHub ↗

localfail are for handing to the local payer if it's local. */

Source from the content-addressed store, hash-verified

215
216/* localfail are for handing to the local payer if it's local. */
217static void fail_out_htlc(struct htlc_out *hout, const char *localfail)
218{
219 htlc_out_check(hout, __func__);
220 assert(hout->failmsg || hout->failonion);
221
222 if (hout->am_origin) {
223 payment_failed(hout->key.channel->peer->ld, hout, localfail);
224 } else if (hout->in) {
225 const struct onionreply *failonion;
226
227 /* If we have an onion, simply copy it. */
228 if (hout->failonion)
229 failonion = hout->failonion;
230 /* Otherwise, we need to onionize this local error. */
231 else
232 failonion = create_onionreply(hout,
233 hout->in->shared_secret,
234 hout->failmsg);
235 fail_in_htlc(hout->in, failonion);
236 } else {
237 log_broken(hout->key.channel->log, "Neither origin nor in?");
238 }
239}
240
241/* BOLT #4:
242 *

Callers 2

destroy_hout_subd_diedFunction · 0.85
remove_htlc_outFunction · 0.85

Calls 4

htlc_out_checkFunction · 0.85
fail_in_htlcFunction · 0.85
payment_failedFunction · 0.70
create_onionreplyFunction · 0.50

Tested by

no test coverage detected