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

Function derive_htlc_scripts

onchaind/onchaind.c:2268–2295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2266}
2267
2268static u8 **derive_htlc_scripts(const struct htlc_stub *htlcs, enum side side)
2269{
2270 size_t i;
2271 u8 **htlc_scripts = tal_arr(htlcs, u8 *, tal_count(htlcs));
2272
2273 for (i = 0; i < tal_count(htlcs); i++) {
2274 if (htlcs[i].owner == side)
2275 htlc_scripts[i] = htlc_offered_wscript(htlc_scripts,
2276 &htlcs[i].ripemd,
2277 keyset,
2278 option_anchor_outputs);
2279 else {
2280 /* FIXME: remove abs_locktime */
2281 struct abs_locktime ltime;
2282 if (!blocks_to_abs_locktime(htlcs[i].cltv_expiry,
2283 &ltime))
2284 status_failed(STATUS_FAIL_INTERNAL_ERROR,
2285 "Could not convert cltv_expiry %u to locktime",
2286 htlcs[i].cltv_expiry);
2287 htlc_scripts[i] = htlc_received_wscript(htlc_scripts,
2288 &htlcs[i].ripemd,
2289 &ltime,
2290 keyset,
2291 option_anchor_outputs);
2292 }
2293 }
2294 return htlc_scripts;
2295}
2296
2297static size_t resolve_our_htlc_ourcommit(struct tracked_output *out,
2298 const size_t *matches,

Callers 3

handle_our_unilateralFunction · 0.85
handle_their_cheatFunction · 0.85
handle_their_unilateralFunction · 0.85

Calls 4

blocks_to_abs_locktimeFunction · 0.85
htlc_offered_wscriptFunction · 0.50
status_failedFunction · 0.50
htlc_received_wscriptFunction · 0.50

Tested by

no test coverage detected