Browse Source

psbt: use elements input init alloc

bump-pyln-proto
niftynei 4 years ago
committed by Rusty Russell
parent
commit
c6656dcbe8
  1. 29
      bitcoin/psbt.c

29
bitcoin/psbt.c

@ -112,18 +112,27 @@ struct wally_psbt_input *psbt_append_input(struct wally_psbt *psbt,
{ {
struct wally_tx_input *tx_in; struct wally_tx_input *tx_in;
struct wally_psbt_input *input; struct wally_psbt_input *input;
size_t insert_at;
insert_at = psbt->num_inputs; if (chainparams->is_elements) {
if (wally_tx_elements_input_init_alloc(txid->shad.sha.u.u8,
if (wally_tx_input_init_alloc(txid->shad.sha.u.u8, sizeof(txid->shad.sha.u.u8),
sizeof(struct bitcoin_txid), outnum, sequence, NULL, 0,
outnum, sequence, NULL, 0, NULL, NULL,
&tx_in) != WALLY_OK) NULL, 0,
abort(); NULL, 0, NULL, 0,
NULL, 0, NULL, 0,
NULL, 0, NULL,
&tx_in) != WALLY_OK)
abort();
} else {
if (wally_tx_input_init_alloc(txid->shad.sha.u.u8,
sizeof(txid->shad.sha.u.u8),
outnum, sequence, NULL, 0, NULL,
&tx_in) != WALLY_OK)
abort();
}
tx_in->features = chainparams->is_elements ? WALLY_TX_IS_ELEMENTS : 0; input = psbt_add_input(psbt, tx_in, psbt->num_inputs);
input = psbt_add_input(psbt, tx_in, insert_at);
wally_tx_input_free(tx_in); wally_tx_input_free(tx_in);
return input; return input;
} }

Loading…
Cancel
Save