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

Function fail_out_htlc

lightningd/peer_htlcs.c:340–369  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

338
339/* localfail are for handing to the local payer if it's local. */
340static void fail_out_htlc(struct htlc_out *hout, const char *localfail)
341{
342 htlc_out_check(hout, __func__);
343 assert(hout->failmsg || hout->failonion);
344
345 if (hout->am_origin) {
346 payment_failed(hout->key.channel->peer->ld,
347 hout->key.channel->log,
348 &hout->payment_hash,
349 hout->partid,
350 hout->groupid,
351 hout->failonion,
352 hout->failmsg,
353 localfail);
354 } else if (hout->in) {
355 const struct onionreply *failonion;
356
357 /* If we have an onion, simply copy it. */
358 if (hout->failonion)
359 failonion = hout->failonion;
360 /* Otherwise, we need to onionize this local error. */
361 else
362 failonion = create_onionreply(hout,
363 hout->in->shared_secret,
364 hout->failmsg);
365 fail_in_htlc(hout->in, failonion);
366 } else {
367 log_broken(hout->key.channel->log, "Neither origin nor in?");
368 }
369}
370
371/* BOLT #4:
372 *

Callers 2

destroy_hout_subd_diedFunction · 0.85
remove_htlc_outFunction · 0.85

Calls 4

htlc_out_checkFunction · 0.85
payment_failedFunction · 0.85
create_onionreplyFunction · 0.85
fail_in_htlcFunction · 0.85

Tested by

no test coverage detected