| 88 | } |
| 89 | |
| 90 | void htlc_set_fulfill(struct htlc_set *set, const struct preimage *preimage) |
| 91 | { |
| 92 | /* BOLT #4: |
| 93 | * - if it fulfills any HTLCs in the HTLC set: |
| 94 | * - MUST fulfill the entire HTLC set. |
| 95 | */ |
| 96 | for (size_t i = 0; i < tal_count(set->inpays); i++) { |
| 97 | /* Don't remove from set */ |
| 98 | tal_del_destructor2(set->inpays[i], |
| 99 | htlc_set_inpay_destroyed, set); |
| 100 | |
| 101 | /* Reparent set->inpays[i] so it's freed with set */ |
| 102 | tal_steal(set->inpays, set->inpays[i]); |
| 103 | set->inpays[i]->succeeded(set->inpays[i]->arg, preimage); |
| 104 | } |
| 105 | tal_free(set); |
| 106 | } |
| 107 | |
| 108 | static struct htlc_set *new_htlc_set(struct lightningd *ld, |
| 109 | struct incoming_payment *inpay, |
no test coverage detected