MCPcopy Create free account
hub / github.com/ElementsProject/lightning / psbt_input_set_wit_utxo

Function psbt_input_set_wit_utxo

bitcoin/psbt.c:415–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415void 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
452void psbt_input_set_utxo(struct wally_psbt *psbt, size_t in,
453 const struct wally_tx *prev_tx)

Callers 10

htlc_timeout_txFunction · 0.85
mainFunction · 0.85
sign_our_inputsFunction · 0.85
bitcoin_tx_add_inputFunction · 0.85
migrate_last_tx_to_psbtFunction · 0.85
psbt_using_utxosFunction · 0.85
splice_initiatorFunction · 0.85
anchor_psbtFunction · 0.85

Calls 4

tal_bytelenFunction · 0.85
tal_wally_startFunction · 0.85
is_elementsFunction · 0.85
tal_wally_endFunction · 0.85

Tested by 2

htlc_timeout_txFunction · 0.68
mainFunction · 0.68