| 73 | } |
| 74 | |
| 75 | static 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 | |
| 99 | struct bitcoin_tx *commit_tx(const tal_t *ctx, |
| 100 | const struct bitcoin_outpoint *funding, |
no test coverage detected