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

Function add_offered_htlc_out

channeld/commit_tx.c:55–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55static void add_offered_htlc_out(struct bitcoin_tx *tx, size_t n,
56 const struct htlc *htlc,
57 const struct keyset *keyset,
58 bool option_anchor_outputs)
59{
60 struct ripemd160 ripemd;
61 u8 *wscript, *p2wsh;
62 struct amount_sat amount = amount_msat_to_sat_round_down(htlc->amount);
63
64 ripemd160(&ripemd, htlc->rhash.u.u8, sizeof(htlc->rhash.u.u8));
65 wscript = htlc_offered_wscript(tx, &ripemd, keyset,
66 option_anchor_outputs);
67 p2wsh = scriptpubkey_p2wsh(tx, wscript);
68 bitcoin_tx_add_output(tx, p2wsh, wscript, amount);
69 SUPERVERBOSE("# HTLC #%" PRIu64 " offered amount %"PRIu64" wscript %s\n", htlc->id,
70 amount.satoshis, /* Raw: BOLT 3 output match */
71 tal_hex(wscript, wscript));
72 tal_free(wscript);
73}
74
75static void add_received_htlc_out(struct bitcoin_tx *tx, size_t n,
76 const struct htlc *htlc,

Callers 1

commit_txFunction · 0.85

Calls 7

bitcoin_tx_add_outputFunction · 0.85
tal_hexFunction · 0.85
tal_freeFunction · 0.85
ripemd160Class · 0.70
htlc_offered_wscriptFunction · 0.50
scriptpubkey_p2wshFunction · 0.50

Tested by

no test coverage detected