| 83 | } |
| 84 | |
| 85 | static 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 | |
| 111 | struct bitcoin_tx *commit_tx(const tal_t *ctx, |
| 112 | const struct bitcoin_outpoint *funding, |
no test coverage detected