Browse Source

psbt: add helper to set the non-witness utxo for an input

We need this info for every dual-funded open
travis-experimental
niftynei 4 years ago
committed by Rusty Russell
parent
commit
93045945be
  1. 11
      bitcoin/psbt.c
  2. 4
      bitcoin/psbt.h

11
bitcoin/psbt.c

@ -314,6 +314,17 @@ void psbt_input_set_wit_utxo(struct wally_psbt *psbt, size_t in,
tal_wally_end(psbt);
}
void psbt_input_set_utxo(struct wally_psbt *psbt, size_t in,
const struct wally_tx *prev_tx)
{
int wally_err;
tal_wally_start();
wally_err = wally_psbt_input_set_utxo(&psbt->inputs[in],
prev_tx);
tal_wally_end(psbt);
assert(wally_err == WALLY_OK);
}
void psbt_input_set_witscript(struct wally_psbt *psbt, size_t in, const u8 *wscript)
{
int wally_err;

4
bitcoin/psbt.h

@ -122,6 +122,10 @@ struct wally_psbt_input *psbt_append_input(struct wally_psbt *psbt,
void psbt_input_set_wit_utxo(struct wally_psbt *psbt, size_t in,
const u8 *scriptPubkey, struct amount_sat amt);
/* psbt_input_set_utxo - Set the non-witness utxo field for this PSBT input */
void psbt_input_set_utxo(struct wally_psbt *psbt, size_t in,
const struct wally_tx *prev_tx);
/* psbt_elements_input_set_asset - Set the asset/value fields for an
* Elements PSBT (PSET, technically */
void psbt_elements_input_set_asset(struct wally_psbt *psbt, size_t in,

Loading…
Cancel
Save