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

Function psbt_input_get_amount

bitcoin/psbt.c:597–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595}
596
597struct amount_sat psbt_input_get_amount(const struct wally_psbt *psbt,
598 size_t in)
599{
600 struct amount_sat val;
601 assert(in < psbt->num_inputs);
602 if (psbt->inputs[in].witness_utxo) {
603 struct amount_asset amt_asset =
604 wally_tx_output_get_amount(psbt->inputs[in].witness_utxo);
605 assert(amount_asset_is_main(&amt_asset));
606 val = amount_asset_to_sat(&amt_asset);
607 } else if (psbt->inputs[in].utxo) {
608 int idx = psbt->inputs[in].index;
609 struct wally_tx *prev_tx = psbt->inputs[in].utxo;
610 val = amount_sat(prev_tx->outputs[idx].satoshi);
611 } else
612 abort();
613
614 return val;
615}
616
617size_t psbt_input_get_weight(const struct wally_psbt *psbt,
618 size_t in,

Callers 11

grind_htlc_tx_feeFunction · 0.85
bitcoin_tx_compute_feeFunction · 0.85
bitcoin_tx_hash_for_sigFunction · 0.85
psbt_compute_feeFunction · 0.85
do_i_sign_firstFunction · 0.85
check_balancesFunction · 0.85
json_openchannel_bumpFunction · 0.85
json_openchannel_initFunction · 0.85
mw_load_outputsFunction · 0.85
check_balancesFunction · 0.85

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