| 413 | } |
| 414 | |
| 415 | void psbt_input_set_wit_utxo(struct wally_psbt *psbt, size_t in, |
| 416 | const u8 *scriptPubkey, struct amount_sat amt) |
| 417 | { |
| 418 | struct wally_tx_output *tx_out; |
| 419 | int wally_err; |
| 420 | |
| 421 | assert(in < psbt->num_inputs); |
| 422 | assert(tal_bytelen(scriptPubkey) > 0); |
| 423 | tal_wally_start(); |
| 424 | if (is_elements(chainparams)) { |
| 425 | u8 value[9]; |
| 426 | wally_err = |
| 427 | wally_tx_confidential_value_from_satoshi(amt.satoshis, /* Raw: wally API */ |
| 428 | value, |
| 429 | sizeof(value)); |
| 430 | assert(wally_err == WALLY_OK); |
| 431 | wally_err = |
| 432 | wally_tx_elements_output_init_alloc(scriptPubkey, |
| 433 | tal_bytelen(scriptPubkey), |
| 434 | chainparams->fee_asset_tag, |
| 435 | ELEMENTS_ASSET_LEN, |
| 436 | value, sizeof(value), |
| 437 | NULL, 0, NULL, 0, |
| 438 | NULL, 0, &tx_out); |
| 439 | |
| 440 | } else |
| 441 | wally_err = wally_tx_output_init_alloc(amt.satoshis, /* Raw: type conv */ |
| 442 | scriptPubkey, |
| 443 | tal_bytelen(scriptPubkey), |
| 444 | &tx_out); |
| 445 | assert(wally_err == WALLY_OK); |
| 446 | wally_err = wally_psbt_input_set_witness_utxo(&psbt->inputs[in], tx_out); |
| 447 | wally_tx_output_free(tx_out); |
| 448 | assert(wally_err == WALLY_OK); |
| 449 | tal_wally_end(psbt); |
| 450 | } |
| 451 | |
| 452 | void psbt_input_set_utxo(struct wally_psbt *psbt, size_t in, |
| 453 | const struct wally_tx *prev_tx) |