From eef762cc09af97523dbf84b1b34253b6b7bb7847 Mon Sep 17 00:00:00 2001 From: niftynei Date: Fri, 31 Jul 2020 12:35:24 -0500 Subject: [PATCH] psbt: re-use init function for create_psbt Less code is more code! --- bitcoin/psbt.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bitcoin/psbt.c b/bitcoin/psbt.c index 21766e91f..1a04f9a67 100644 --- a/bitcoin/psbt.c +++ b/bitcoin/psbt.c @@ -57,12 +57,7 @@ struct wally_psbt *new_psbt(const tal_t *ctx, const struct wally_tx *wtx) struct wally_psbt *psbt; int wally_err; - if (is_elements(chainparams)) - wally_err = wally_psbt_elements_init_alloc(0, wtx->num_inputs, wtx->num_outputs, 0, &psbt); - else - wally_err = wally_psbt_init_alloc(0, wtx->num_inputs, wtx->num_outputs, 0, &psbt); - assert(wally_err == WALLY_OK); - tal_add_destructor(psbt, psbt_destroy); + psbt = init_psbt(ctx, wtx->num_inputs, wtx->num_outputs); /* Set directly: avoids psbt checks for non-NULL scripts/witnesses */ wally_err = wally_tx_clone_alloc(wtx, 0, &psbt->tx);