MCPcopy Create free account
hub / github.com/ElementsProject/lightning / psbt_input_set_final_witness_stack

Function psbt_input_set_final_witness_stack

common/psbt_internal.c:58–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58static void
59psbt_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
89void psbt_finalize_input(const tal_t *ctx,
90 struct wally_psbt_input *in,

Callers 1

psbt_finalize_inputFunction · 0.85

Calls 5

next_sizeFunction · 0.85
tal_wally_startFunction · 0.85
next_scriptFunction · 0.85
tal_wally_endFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected