We don't have enough info to make this from first principles, but we have * an example tx, so just mangle that. */
| 379 | /* We don't have enough info to make this from first principles, but we have |
| 380 | * an example tx, so just mangle that. */ |
| 381 | struct bitcoin_tx *htlc_timeout_tx(const tal_t *ctx, |
| 382 | const struct chainparams *chainparams, |
| 383 | const struct bitcoin_outpoint *commit UNNEEDED, |
| 384 | const u8* commit_wscript, |
| 385 | struct amount_msat htlc_msatoshi, |
| 386 | u32 cltv_expiry, |
| 387 | u16 to_self_delay UNNEEDED, |
| 388 | u32 feerate_per_kw UNNEEDED, |
| 389 | const struct keyset *keyset UNNEEDED, |
| 390 | bool option_anchor_outputs) |
| 391 | { |
| 392 | struct bitcoin_tx *tx; |
| 393 | struct amount_sat in_amount; |
| 394 | |
| 395 | tx = bitcoin_tx_from_hex(ctx, "0200000001a02a38c6ec5541963704a2a035b3094b18d69cc25cc7419d75e02894618329720000000000000000000191ea3000000000002200208bfadb3554f41cc06f00de0ec2e2f91e36ee45b5006a1f606146784755356ba532f10800", |
| 396 | strlen("0200000001a02a38c6ec5541963704a2a035b3094b18d69cc25cc7419d75e02894618329720000000000000000000191ea3000000000002200208bfadb3554f41cc06f00de0ec2e2f91e36ee45b5006a1f606146784755356ba532f10800")); |
| 397 | assert(tx); |
| 398 | |
| 399 | in_amount = amount_msat_to_sat_round_down(htlc_msatoshi); |
| 400 | psbt_input_set_wit_utxo(tx->psbt, 0, |
| 401 | scriptpubkey_p2wsh(tx->psbt, commit_wscript), |
| 402 | in_amount); |
| 403 | psbt_input_set_witscript(tx->psbt, 0, commit_wscript); |
| 404 | tx->chainparams = chainparams; |
| 405 | |
| 406 | bitcoin_tx_set_locktime(tx, cltv_expiry); |
| 407 | return tx; |
| 408 | } |
| 409 | |
| 410 | int main(int argc, char *argv[]) |
| 411 | { |
nothing calls this directly
no test coverage detected