| 69 | } |
| 70 | |
| 71 | struct bitcoin_tx *htlc_success_tx(const tal_t *ctx, |
| 72 | const struct chainparams *chainparams, |
| 73 | const struct bitcoin_outpoint *commit, |
| 74 | const u8 *commit_wscript, |
| 75 | struct amount_msat htlc_msatoshi, |
| 76 | u16 to_self_delay, |
| 77 | u32 feerate_per_kw, |
| 78 | const struct keyset *keyset, |
| 79 | bool option_anchor_outputs, |
| 80 | bool option_anchors_zero_fee_htlc_tx) |
| 81 | { |
| 82 | const u8 *htlc_wscript; |
| 83 | |
| 84 | htlc_wscript = bitcoin_wscript_htlc_tx(tmpctx, |
| 85 | to_self_delay, |
| 86 | &keyset->self_revocation_key, |
| 87 | &keyset->self_delayed_payment_key); |
| 88 | /* BOLT #3: |
| 89 | * * locktime: `0` for HTLC-success, `cltv_expiry` for HTLC-timeout |
| 90 | */ |
| 91 | return htlc_tx(ctx, chainparams, commit, |
| 92 | commit_wscript, |
| 93 | amount_msat_to_sat_round_down(htlc_msatoshi), |
| 94 | htlc_wscript, |
| 95 | htlc_success_fee(feerate_per_kw, |
| 96 | option_anchor_outputs, |
| 97 | option_anchors_zero_fee_htlc_tx), |
| 98 | 0, |
| 99 | option_anchor_outputs, |
| 100 | option_anchors_zero_fee_htlc_tx); |
| 101 | } |
| 102 | |
| 103 | /* Fill in the witness for HTLC-success tx produced above. */ |
| 104 | void htlc_success_tx_add_witness(struct bitcoin_tx *htlc_success, |