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

Function add_received_htlc_out

channeld/commit_tx.c:85–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85static void add_received_htlc_out(struct bitcoin_tx *tx, size_t n,
86 const struct htlc *htlc,
87 const struct keyset *keyset,
88 bool option_anchor_outputs,
89 bool option_anchors_zero_fee_htlc_tx)
90{
91 struct ripemd160 ripemd;
92 u8 *wscript, *p2wsh;
93 struct amount_sat amount;
94
95 ripemd160(&ripemd, htlc->rhash.u.u8, sizeof(htlc->rhash.u.u8));
96 wscript = htlc_received_wscript(tx, &ripemd, &htlc->expiry, keyset,
97 option_anchor_outputs,
98 option_anchors_zero_fee_htlc_tx);
99 p2wsh = scriptpubkey_p2wsh(tx, wscript);
100 amount = amount_msat_to_sat_round_down(htlc->amount);
101
102 bitcoin_tx_add_output(tx, p2wsh, wscript, amount);
103
104 SUPERVERBOSE("# HTLC #%"PRIu64" received amount %"PRIu64" wscript %s\n",
105 htlc->id,
106 amount.satoshis, /* Raw: BOLT 3 output match */
107 tal_hex(wscript, wscript));
108 tal_free(wscript);
109}
110
111struct bitcoin_tx *commit_tx(const tal_t *ctx,
112 const struct bitcoin_outpoint *funding,

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_received_wscriptFunction · 0.50

Tested by

no test coverage detected