Browse Source

tx: use elements_input_init_alloc

bump-pyln-proto
niftynei 4 years ago
committed by Rusty Russell
parent
commit
d1d96a9952
  1. 26
      bitcoin/tx.c

26
bitcoin/tx.c

@ -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;
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);
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);

Loading…
Cancel
Save