mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
psbt: method to clone a PSBT onto a context
wally offers up `wally_clone_psbt` but it's a bit clunky (requires checking return value, starting/stopping the wally_allocation context) Helper method wraps this all up nice + neat!
This commit is contained in:
parent
7ba6097d3c
commit
10fce07d96
@ -62,6 +62,16 @@ struct wally_psbt *create_psbt(const tal_t *ctx, size_t num_inputs, size_t num_o
|
||||
return psbt;
|
||||
}
|
||||
|
||||
struct wally_psbt *clone_psbt(const tal_t *ctx, struct wally_psbt *psbt)
|
||||
{
|
||||
struct wally_psbt *clone;
|
||||
tal_wally_start();
|
||||
if (wally_psbt_clone_alloc(psbt, 0, &clone) != WALLY_OK)
|
||||
abort();
|
||||
tal_wally_end(tal_steal(ctx, clone));
|
||||
return clone;
|
||||
}
|
||||
|
||||
struct wally_psbt *new_psbt(const tal_t *ctx, const struct wally_tx *wtx)
|
||||
{
|
||||
struct wally_psbt *psbt;
|
||||
|
@ -49,6 +49,14 @@ struct wally_psbt *create_psbt(const tal_t *ctx, size_t num_inputs, size_t num_o
|
||||
struct wally_psbt *new_psbt(const tal_t *ctx,
|
||||
const struct wally_tx *wtx);
|
||||
|
||||
/**
|
||||
* clone_psbt - Clone a PSBT onto passed in context
|
||||
*
|
||||
* @ctx - allocation context
|
||||
* @psbt - psbt to be cloned
|
||||
*/
|
||||
struct wally_psbt *clone_psbt(const tal_t *ctx, struct wally_psbt *psbt);
|
||||
|
||||
/**
|
||||
* psbt_is_finalized - Check if tx is ready to be extracted
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user