From d1d96a99523993dd3a7b1ef766a7f6d93f6130f3 Mon Sep 17 00:00:00 2001 From: niftynei Date: Thu, 13 Aug 2020 11:38:23 -0500 Subject: [PATCH] tx: use elements_input_init_alloc --- bitcoin/tx.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/bitcoin/tx.c b/bitcoin/tx.c index fb47428e4..946ab574e 100644 --- a/bitcoin/tx.c +++ b/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);