| 51 | } |
| 52 | |
| 53 | static struct bitcoin_tx *funding_tx(const tal_t *ctx, |
| 54 | const struct utxo *utxo, |
| 55 | struct amount_sat funding, |
| 56 | const struct pubkey *local_fundingkey, |
| 57 | const struct pubkey *remote_fundingkey) |
| 58 | { |
| 59 | u8 *wscript; |
| 60 | struct bitcoin_tx *tx; |
| 61 | |
| 62 | tx = tx_spending_utxo(ctx, utxo, |
| 63 | 1, 0, BITCOIN_TX_DEFAULT_SEQUENCE); |
| 64 | |
| 65 | wscript = bitcoin_redeem_2of2(tx, local_fundingkey, remote_fundingkey); |
| 66 | bitcoin_tx_add_output(tx, scriptpubkey_p2wsh(tx, wscript), wscript, funding); |
| 67 | tal_free(wscript); |
| 68 | |
| 69 | bitcoin_tx_finalize(tx); |
| 70 | assert(bitcoin_tx_check(tx)); |
| 71 | return tx; |
| 72 | } |
| 73 | |
| 74 | int main(int argc, char *argv[]) |
| 75 | { |
no test coverage detected