bitcoin/psbt.c: Add psbt_insert_output function.

This commit is contained in:
ZmnSCPxj jxPCSnmZ
2020-09-09 19:56:14 +09:30
committed by Rusty Russell
parent e04febfe0c
commit 5d7178d488
2 changed files with 16 additions and 0 deletions

View File

@@ -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)

View File

@@ -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);