mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 07:34:21 +01:00
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
This commit is contained in:
committed by
Christian Decker
parent
891f61ad48
commit
58282819a9
@@ -68,9 +68,26 @@ struct wally_psbt *new_psbt(const tal_t *ctx, const struct wally_tx *wtx)
|
||||
|
||||
/* set the scripts + witnesses back */
|
||||
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_len = script_lens[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);
|
||||
|
||||
Reference in New Issue
Block a user