Browse Source

psbt: if a transaction has witnesses/scriptSig set, add it to psbt

For any transaction that's got 'finalized' signature data for an input,
we should add this information to the psbt also
nifty/pset-pre
niftynei 4 years ago
committed by Christian Decker
parent
commit
58282819a9
  1. 17
      bitcoin/psbt.c

17
bitcoin/psbt.c

@ -68,9 +68,26 @@ struct wally_psbt *new_psbt(const tal_t *ctx, const struct wally_tx *wtx)
/* set the scripts + witnesses back */ /* set the scripts + witnesses back */
for (size_t i = 0; i < wtx->num_inputs; i++) { for (size_t i = 0; i < wtx->num_inputs; i++) {
int wally_err;
wtx->inputs[i].script = (unsigned char *)scripts[i]; wtx->inputs[i].script = (unsigned char *)scripts[i];
wtx->inputs[i].script_len = script_lens[i]; wtx->inputs[i].script_len = script_lens[i];
wtx->inputs[i].witness = witnesses[i]; wtx->inputs[i].witness = witnesses[i];
/* add these scripts + witnesses to the psbt */
if (scripts[i]) {
wally_err =
wally_psbt_input_set_final_script_sig(&psbt->inputs[i],
(unsigned char *)scripts[i],
script_lens[i]);
assert(wally_err == WALLY_OK);
}
if (witnesses[i]) {
wally_err =
wally_psbt_input_set_final_witness(&psbt->inputs[i],
witnesses[i]);
assert(wally_err == WALLY_OK);
}
} }
tal_free(witnesses); tal_free(witnesses);

Loading…
Cancel
Save