| 59 | } |
| 60 | |
| 61 | void 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 | |
| 90 | void htlc_set_fulfill(struct htlc_set *set, const struct preimage *preimage) |
| 91 | { |
nothing calls this directly
no test coverage detected