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

Function derive_htlc_scripts

onchaind/onchaind.c:1950–1979  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1948}
1949
1950static u8 **derive_htlc_scripts(const struct htlc_stub *htlcs, enum side side)
1951{
1952 size_t i;
1953 u8 **htlc_scripts = tal_arr(htlcs, u8 *, tal_count(htlcs));
1954
1955 for (i = 0; i < tal_count(htlcs); i++) {
1956 if (htlcs[i].owner == side)
1957 htlc_scripts[i] = htlc_offered_wscript(htlc_scripts,
1958 &htlcs[i].ripemd,
1959 keyset,
1960 option_anchor_outputs,
1961 option_anchors_zero_fee_htlc_tx);
1962 else {
1963 /* FIXME: remove abs_locktime */
1964 struct abs_locktime ltime;
1965 if (!blocks_to_abs_locktime(htlcs[i].cltv_expiry,
1966 &ltime))
1967 status_failed(STATUS_FAIL_INTERNAL_ERROR,
1968 "Could not convert cltv_expiry %u to locktime",
1969 htlcs[i].cltv_expiry);
1970 htlc_scripts[i] = htlc_received_wscript(htlc_scripts,
1971 &htlcs[i].ripemd,
1972 &ltime,
1973 keyset,
1974 option_anchor_outputs,
1975 option_anchors_zero_fee_htlc_tx);
1976 }
1977 }
1978 return htlc_scripts;
1979}
1980
1981static size_t resolve_our_htlc_ourcommit(struct tracked_output *out,
1982 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