tx: use elements_input_init_alloc

This commit is contained in:
niftynei 2020-08-13 11:38:23 -05:00 committed by Rusty Russell
parent c6656dcbe8
commit d1d96a9952

View File

@ -193,14 +193,26 @@ int bitcoin_tx_add_input(struct bitcoin_tx *tx, const struct bitcoin_txid *txid,
assert(tx->wtx != NULL);
i = tx->wtx->num_inputs;
if (chainparams->is_elements)
wally_err =
wally_tx_elements_input_init_alloc(txid->shad.sha.u.u8,
sizeof(struct bitcoin_txid),
outnum, sequence,
scriptSig, tal_bytelen(scriptSig),
NULL /* Empty witness stack */,
NULL, 0, NULL, 0,
NULL, 0, NULL, 0,
NULL, 0, NULL, 0,
NULL, &input);
else
wally_err = wally_tx_input_init_alloc(txid->shad.sha.u.u8,
sizeof(struct bitcoin_txid),
outnum, sequence,
scriptSig, tal_bytelen(scriptSig),
NULL /* Empty witness stack */,
&input);
assert(wally_err == WALLY_OK);
input->features = chainparams->is_elements ? WALLY_TX_IS_ELEMENTS : 0;
wally_tx_add_input(tx->wtx, input);
psbt_add_input(tx->psbt, input, i);