mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-23 06:55:13 +01:00
psbt_txid: it's possible a psbt may already have the finalized scriptsig
If we've already got a scriptSig field filled out for a PSBT input, we use that instead of 'deriving' the scriptSig from the redeemscript (finalizing a PSBT removes the redeemscript field)
This commit is contained in:
parent
c5f748e716
commit
1f165c00ae
1 changed files with 13 additions and 9 deletions
|
@ -748,9 +748,12 @@ void psbt_txid(const tal_t *ctx,
|
|||
wally_tx_clone_alloc(psbt->tx, 0, &tx);
|
||||
|
||||
for (size_t i = 0; i < tx->num_inputs; i++) {
|
||||
if (psbt->inputs[i].final_scriptsig) {
|
||||
wally_tx_set_input_script(tx, i,
|
||||
psbt->inputs[i].final_scriptsig,
|
||||
psbt->inputs[i].final_scriptsig_len);
|
||||
} else if (psbt->inputs[i].redeem_script) {
|
||||
u8 *script;
|
||||
if (!psbt->inputs[i].redeem_script)
|
||||
continue;
|
||||
|
||||
/* P2SH requires push of the redeemscript, from libwally src */
|
||||
script = tal_arr(tmpctx, u8, 0);
|
||||
|
@ -759,6 +762,7 @@ void psbt_txid(const tal_t *ctx,
|
|||
psbt->inputs[i].redeem_script_len);
|
||||
wally_tx_set_input_script(tx, i, script, tal_bytelen(script));
|
||||
}
|
||||
}
|
||||
tal_gather_wally(tal_steal(ctx, tx));
|
||||
|
||||
wally_txid(tx, txid);
|
||||
|
|
Loading…
Add table
Reference in a new issue