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

Function htlc_set_fail_

lightningd/htlc_set.c:61–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void htlc_set_fail_(struct htlc_set *set, const u8 *failmsg TAKES,
62 const char *file, int line)
63{
64 /* Don't let local_fail_in_htlc take! */
65 if (taken(failmsg))
66 tal_steal(set, failmsg);
67
68 for (size_t i = 0; i < tal_count(set->inpays); i++) {
69 const u8 *this_failmsg;
70
71 /* Don't remove from set */
72 tal_del_destructor2(set->inpays[i], htlc_set_inpay_destroyed, set);
73
74 if (tal_bytelen(failmsg) == 0)
75 this_failmsg = towire_incorrect_or_unknown_payment_details(tmpctx, set->inpays[i]->msat, get_block_height(set->ld->topology));
76 else
77 this_failmsg = failmsg;
78
79 log_debug(set->inpays[i]->log,
80 "failing with %s: %s:%u",
81 onion_wire_name(fromwire_peektype(this_failmsg)),
82 file, line);
83 /* Attach inpays[i] to set so it's freed below (not with arg) */
84 tal_steal(set->inpays, set->inpays[i]);
85 set->inpays[i]->fail(set->inpays[i]->arg, this_failmsg);
86 }
87 tal_free(set);
88}
89
90void htlc_set_fulfill(struct htlc_set *set, const struct preimage *preimage)
91{

Callers

nothing calls this directly

Calls 6

takenFunction · 0.85
tal_bytelenFunction · 0.85
fromwire_peektypeFunction · 0.85
tal_freeFunction · 0.85
failMethod · 0.80
get_block_heightFunction · 0.70

Tested by

no test coverage detected