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

Function psbt_input_get_amount

bitcoin/psbt.c:435–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433}
434
435struct amount_sat psbt_input_get_amount(const struct wally_psbt *psbt,
436 size_t in)
437{
438 struct amount_sat val;
439 assert(in < psbt->num_inputs);
440 if (psbt->inputs[in].witness_utxo) {
441 struct amount_asset amt_asset =
442 wally_tx_output_get_amount(psbt->inputs[in].witness_utxo);
443 assert(amount_asset_is_main(&amt_asset));
444 val = amount_asset_to_sat(&amt_asset);
445 } else if (psbt->inputs[in].utxo) {
446 int idx = psbt->tx->inputs[in].index;
447 struct wally_tx *prev_tx = psbt->inputs[in].utxo;
448 val = amount_sat(prev_tx->outputs[idx].satoshi);
449 } else
450 abort();
451
452 return val;
453}
454
455struct amount_sat psbt_output_get_amount(const struct wally_psbt *psbt,
456 size_t out)

Callers 10

bitcoin_tx_compute_feeFunction · 0.70
bitcoin_tx_hash_for_sigFunction · 0.70
psbt_compute_feeFunction · 0.70
grind_htlc_tx_feeFunction · 0.50
replace_penalty_tx_to_usFunction · 0.50
json_openchannel_bumpFunction · 0.50
json_openchannel_initFunction · 0.50
mw_load_outputsFunction · 0.50
check_balancesFunction · 0.50

Calls 5

abortFunction · 0.85
amount_satClass · 0.70
amount_asset_is_mainFunction · 0.50
amount_asset_to_satFunction · 0.50

Tested by

no test coverage detected