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

Function resolve_our_htlc_theircommit

onchaind/onchaind.c:2408–2436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2406}
2407
2408static size_t resolve_our_htlc_theircommit(struct tracked_output *out,
2409 const size_t *matches,
2410 const struct htlc_stub *htlcs,
2411 u8 **htlc_scripts)
2412{
2413 struct bitcoin_tx *tx;
2414 enum tx_type tx_type = OUR_HTLC_TIMEOUT_TO_US;
2415 u32 cltv_expiry = matches_cltv(matches, htlcs);
2416
2417 /* BOLT #5:
2418 *
2419 * ## HTLC Output Handling: Remote Commitment, Local Offers
2420 * ...
2421 *
2422 * - if the commitment transaction HTLC output has *timed out* AND NOT
2423 * been *resolved*:
2424 * - MUST *resolve* the output, by spending it to a convenient
2425 * address.
2426 */
2427 tx = tx_to_us(out, remote_htlc_to_us, out,
2428 option_anchor_outputs ? 1 : 0,
2429 cltv_expiry, NULL, 0,
2430 htlc_scripts[matches[0]], &tx_type, htlc_feerate);
2431
2432 propose_resolution_at_block(out, tx, cltv_expiry, tx_type);
2433
2434 /* They're all equivalent: might as well use first one. */
2435 return matches[0];
2436}
2437
2438/* Returns which htlcs it chose to use of matches[] */
2439static size_t resolve_their_htlc(struct tracked_output *out,

Callers 1

handle_their_unilateralFunction · 0.85

Calls 3

matches_cltvFunction · 0.85
tx_to_usFunction · 0.85

Tested by

no test coverage detected