| 17 | } |
| 18 | |
| 19 | struct wally_psbt *create_psbt(const tal_t *ctx, size_t num_inputs, size_t num_outputs, u32 locktime) |
| 20 | { |
| 21 | const u32 init_flags = is_elements(chainparams) ? WALLY_PSBT_INIT_PSET : 0; |
| 22 | struct wally_psbt *psbt; |
| 23 | int wally_err; |
| 24 | |
| 25 | tal_wally_start(); |
| 26 | wally_err = wally_psbt_init_alloc(2, num_inputs, num_outputs, 0, init_flags, &psbt); |
| 27 | assert(wally_err == WALLY_OK); |
| 28 | wally_psbt_set_fallback_locktime(psbt, locktime); |
| 29 | /* By default we are modifying them internally; allow it */ |
| 30 | wally_psbt_set_tx_modifiable_flags(psbt, WALLY_PSBT_TXMOD_INPUTS | WALLY_PSBT_TXMOD_OUTPUTS); |
| 31 | tal_add_destructor(psbt, psbt_destroy); |
| 32 | tal_wally_end_onto(ctx, psbt, struct wally_psbt); |
| 33 | |
| 34 | return psbt; |
| 35 | } |
| 36 | |
| 37 | struct wally_psbt *clone_psbt(const tal_t *ctx, const struct wally_psbt *psbt) |
| 38 | { |