Browse Source

psbt: Use wallys function to check PST finalization status

Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
bump-pyln-proto
Jon Griffiths 4 years ago
committed by Rusty Russell
parent
commit
fef155a9e2
  1. 13
      bitcoin/psbt.c
  2. 2
      bitcoin/psbt.h

13
bitcoin/psbt.c

@ -60,15 +60,12 @@ struct wally_psbt *new_psbt(const tal_t *ctx, const struct wally_tx *wtx)
return tal_steal(ctx, psbt);
}
bool psbt_is_finalized(struct wally_psbt *psbt)
bool psbt_is_finalized(const struct wally_psbt *psbt)
{
for (size_t i = 0; i < psbt->num_inputs; i++) {
if (!psbt->inputs[i].final_scriptsig &&
!psbt->inputs[i].final_witness)
return false;
}
return true;
size_t is_finalized;
int wally_err = wally_psbt_is_finalized(psbt, &is_finalized);
assert(wally_err == WALLY_OK);
return is_finalized ? true : false;
}
struct wally_psbt_input *psbt_add_input(struct wally_psbt *psbt,

2
bitcoin/psbt.h

@ -29,7 +29,7 @@ struct wally_psbt *new_psbt(const tal_t *ctx,
* a psbt has the finalized script sig and/or witness data populated
* for such a call
*/
bool psbt_is_finalized(struct wally_psbt *psbt);
bool psbt_is_finalized(const struct wally_psbt *psbt);
struct wally_tx *psbt_finalize(struct wally_psbt *psbt, bool finalize_in_place);

Loading…
Cancel
Save