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

Function fail_out_htlc

lightningd/peer_htlcs.c:296–325  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

294
295/* localfail are for handing to the local payer if it's local. */
296static void fail_out_htlc(struct htlc_out *hout, const char *localfail)
297{
298 htlc_out_check(hout, __func__);
299 assert(hout->failmsg || hout->failonion);
300
301 if (hout->am_origin) {
302 payment_failed(hout->key.channel->peer->ld,
303 hout->key.channel->log,
304 &hout->payment_hash,
305 hout->partid,
306 hout->groupid,
307 hout->failonion,
308 hout->failmsg,
309 localfail);
310 } else if (hout->in) {
311 const struct onionreply *failonion;
312
313 /* If we have an onion, simply copy it. */
314 if (hout->failonion)
315 failonion = hout->failonion;
316 /* Otherwise, we need to onionize this local error. */
317 else
318 failonion = create_onionreply(hout,
319 hout->in->shared_secret,
320 hout->failmsg);
321 fail_in_htlc(hout->in, failonion);
322 } else {
323 log_broken(hout->key.channel->log, "Neither origin nor in?");
324 }
325}
326
327/* BOLT #4:
328 *

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