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

Function add_offered_htlc_out

channeld/commit_tx.c:63–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

commit_txFunction · 0.85

Calls 7

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

Tested by

no test coverage detected