| 56 | } |
| 57 | |
| 58 | static void |
| 59 | psbt_input_set_final_witness_stack(const tal_t *ctx, |
| 60 | struct wally_psbt_input *in, |
| 61 | const struct witness *witness) |
| 62 | { |
| 63 | u8 *script, *sctx; |
| 64 | const u8 *data = witness->witness_data; |
| 65 | size_t size, max = tal_count(data); |
| 66 | bool ok; |
| 67 | |
| 68 | wally_psbt_input_set_final_witness(in, NULL); |
| 69 | |
| 70 | /* FIXME: return an error?? */ |
| 71 | if (!next_size(&data, &max, &size)) |
| 72 | return; |
| 73 | |
| 74 | tal_wally_start(); |
| 75 | sctx = tal(NULL, u8); |
| 76 | |
| 77 | wally_tx_witness_stack_init_alloc(size, &in->final_witness); |
| 78 | |
| 79 | while ((script = next_script(sctx, &data, &max)) && script != NULL) { |
| 80 | ok = (wally_tx_witness_stack_add(in->final_witness, |
| 81 | script, tal_count(script)) == WALLY_OK); |
| 82 | assert(ok); |
| 83 | } |
| 84 | |
| 85 | tal_wally_end(ctx); |
| 86 | tal_free(sctx); |
| 87 | } |
| 88 | |
| 89 | void psbt_finalize_input(const tal_t *ctx, |
| 90 | struct wally_psbt_input *in, |
no test coverage detected