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

Function add_received_htlc_out

channeld/commit_tx.c:75–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75static void add_received_htlc_out(struct bitcoin_tx *tx, size_t n,
76 const struct htlc *htlc,
77 const struct keyset *keyset,
78 bool option_anchor_outputs)
79{
80 struct ripemd160 ripemd;
81 u8 *wscript, *p2wsh;
82 struct amount_sat amount;
83
84 ripemd160(&ripemd, htlc->rhash.u.u8, sizeof(htlc->rhash.u.u8));
85 wscript = htlc_received_wscript(tx, &ripemd, &htlc->expiry, keyset,
86 option_anchor_outputs);
87 p2wsh = scriptpubkey_p2wsh(tx, wscript);
88 amount = amount_msat_to_sat_round_down(htlc->amount);
89
90 bitcoin_tx_add_output(tx, p2wsh, wscript, amount);
91
92 SUPERVERBOSE("# HTLC #%"PRIu64" received amount %"PRIu64" wscript %s\n",
93 htlc->id,
94 amount.satoshis, /* Raw: BOLT 3 output match */
95 tal_hex(wscript, wscript));
96 tal_free(wscript);
97}
98
99struct bitcoin_tx *commit_tx(const tal_t *ctx,
100 const struct bitcoin_outpoint *funding,

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

Tested by

no test coverage detected