mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 09:40:19 +01:00
psbt: remove script sig info from inputs before adding them to global
PSBT's dont' serialize / unserialize if there's any sig info set on the global transaction
This commit is contained in:
parent
16656a85cf
commit
80072b389e
1 changed files with 22 additions and 0 deletions
|
@ -116,10 +116,32 @@ struct wally_psbt_input *psbt_add_input(struct wally_psbt *psbt,
|
|||
{
|
||||
struct wally_tx *tx;
|
||||
struct wally_tx_input tmp_in;
|
||||
u8 *script;
|
||||
size_t scriptlen = 0;
|
||||
struct wally_tx_witness_stack *witness = NULL;
|
||||
|
||||
tx = psbt->tx;
|
||||
assert(insert_at <= tx->num_inputs);
|
||||
|
||||
/* Remove any script sig or witness info before adding it ! */
|
||||
if (input->script_len > 0) {
|
||||
scriptlen = input->script_len;
|
||||
input->script_len = 0;
|
||||
script = (u8 *)input->script;
|
||||
input->script = NULL;
|
||||
}
|
||||
if (input->witness) {
|
||||
witness = input->witness;
|
||||
input->witness = NULL;
|
||||
}
|
||||
wally_tx_add_input(tx, input);
|
||||
/* Put the script + witness info back */
|
||||
if (scriptlen > 0) {
|
||||
input->script_len = scriptlen;
|
||||
input->script = script;
|
||||
}
|
||||
if (witness)
|
||||
input->witness = witness;
|
||||
|
||||
tmp_in = tx->inputs[tx->num_inputs - 1];
|
||||
MAKE_ROOM(tx->inputs, insert_at, tx->num_inputs);
|
||||
|
|
Loading…
Add table
Reference in a new issue