Skip to content

Commit

Permalink
psbt: re-use init function for create_psbt
Browse files Browse the repository at this point in the history
Less code is more code!
  • Loading branch information
niftynei authored and rustyrussell committed Aug 18, 2020
1 parent c0d0272 commit eef762c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions bitcoin/psbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit eef762c

Please sign in to comment.