Browse Source

bitcoin/psbt.c: Add psbt_insert_output function.

bump-pyln-proto
ZmnSCPxj jxPCSnmZ 4 years ago
committed by Rusty Russell
parent
commit
5d7178d488
  1. 12
      bitcoin/psbt.c
  2. 4
      bitcoin/psbt.h

12
bitcoin/psbt.c

@ -183,6 +183,18 @@ struct wally_psbt_output *psbt_append_output(struct wally_psbt *psbt,
wally_tx_output_free(tx_out);
return out;
}
struct wally_psbt_output *psbt_insert_output(struct wally_psbt *psbt,
const u8 *script,
struct amount_sat amount,
size_t insert_at)
{
struct wally_psbt_output *out;
struct wally_tx_output *tx_out = wally_tx_output(script, amount);
out = psbt_add_output(psbt, tx_out, insert_at);
wally_tx_output_free(tx_out);
return out;
}
void psbt_rm_output(struct wally_psbt *psbt,
size_t remove_at)

4
bitcoin/psbt.h

@ -119,6 +119,10 @@ struct wally_psbt_output *psbt_add_output(struct wally_psbt *psbt,
struct wally_psbt_output *psbt_append_output(struct wally_psbt *psbt,
const u8 *script,
struct amount_sat amount);
struct wally_psbt_output *psbt_insert_output(struct wally_psbt *psbt,
const u8 *script,
struct amount_sat amount,
size_t insert_at);
void psbt_rm_output(struct wally_psbt *psbt,
size_t remove_at);

Loading…
Cancel
Save