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

Function local_fail_in_htlc

lightningd/peer_htlcs.c:311–327  ·  view source on GitHub ↗

This is used for cases where we can immediately fail the HTLC. */

Source from the content-addressed store, hash-verified

309
310/* This is used for cases where we can immediately fail the HTLC. */
311void local_fail_in_htlc(struct htlc_in *hin, const u8 *failmsg TAKES)
312{
313 struct onionreply *failonion;
314
315 /* We failed it for another reason (shutting down, dust) before
316 * noticing the onion was bad: we can only say it was malformed. */
317 if (!hin->shared_secret) {
318 tal_free_if_taken(failmsg);
319 local_fail_in_htlc_badonion(hin, unparsable_onion_code(hin));
320 return;
321 }
322
323 failonion = create_onionreply(NULL, hin->shared_secret, failmsg);
324 tal_free_if_taken(failmsg);
325
326 fail_in_htlc(hin, take(failonion));
327}
328
329/* Helper to create (common) WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS */
330const u8 *failmsg_incorrect_or_unknown(const tal_t *ctx,

Callers 11

drop_to_chainFunction · 0.70
handle_localpayFunction · 0.70
forward_htlcFunction · 0.70
htlc_accepted_hook_finalFunction · 0.70
check_already_failedFunction · 0.70
onchain_failed_our_htlcFunction · 0.70
peer_got_revokeFunction · 0.70
htlcs_resubmitFunction · 0.70

Calls 5

tal_free_if_takenFunction · 0.85
unparsable_onion_codeFunction · 0.85
create_onionreplyFunction · 0.85
fail_in_htlcFunction · 0.85

Tested by

no test coverage detected