|
|
@ -429,6 +429,7 @@ struct bitcoin_tx *bitcoin_tx(const tal_t *ctx, |
|
|
|
varint_t input_count, varint_t output_count, |
|
|
|
u32 nlocktime) |
|
|
|
{ |
|
|
|
int ret; |
|
|
|
struct bitcoin_tx *tx = tal(ctx, struct bitcoin_tx); |
|
|
|
assert(chainparams); |
|
|
|
|
|
|
@ -447,6 +448,12 @@ struct bitcoin_tx *bitcoin_tx(const tal_t *ctx, |
|
|
|
tx->wtx->version = 2; |
|
|
|
tx->output_witscripts = tal_arrz(tx, struct witscript*, output_count); |
|
|
|
tx->chainparams = chainparams; |
|
|
|
|
|
|
|
ret = wally_psbt_init_alloc(input_count, output_count, |
|
|
|
0, &tx->psbt); |
|
|
|
assert(ret == WALLY_OK); |
|
|
|
ret = wally_psbt_set_global_tx(tx->psbt, tx->wtx); |
|
|
|
|
|
|
|
return tx; |
|
|
|
} |
|
|
|
|
|
|
@ -467,7 +474,7 @@ struct bitcoin_tx *pull_bitcoin_tx(const tal_t *ctx, const u8 **cursor, |
|
|
|
size_t *max) |
|
|
|
{ |
|
|
|
size_t wsize; |
|
|
|
int flags = WALLY_TX_FLAG_USE_WITNESS; |
|
|
|
int flags = WALLY_TX_FLAG_USE_WITNESS, ret; |
|
|
|
struct bitcoin_tx *tx = tal(ctx, struct bitcoin_tx); |
|
|
|
|
|
|
|
if (chainparams->is_elements) |
|
|
@ -494,6 +501,12 @@ struct bitcoin_tx *pull_bitcoin_tx(const tal_t *ctx, const u8 **cursor, |
|
|
|
tal_arrz(tx, struct amount_sat *, tx->wtx->inputs_allocation_len); |
|
|
|
tx->chainparams = chainparams; |
|
|
|
|
|
|
|
ret = wally_psbt_init_alloc(tx->wtx->num_inputs, tx->wtx->num_outputs, |
|
|
|
0, &tx->psbt); |
|
|
|
assert(ret == WALLY_OK); |
|
|
|
ret = wally_psbt_set_global_tx(tx->psbt, tx->wtx); |
|
|
|
|
|
|
|
|
|
|
|
*cursor += wsize; |
|
|
|
*max -= wsize; |
|
|
|
return tx; |
|
|
|