| 595 | } |
| 596 | |
| 597 | struct 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 | |
| 617 | size_t psbt_input_get_weight(const struct wally_psbt *psbt, |
| 618 | size_t in, |
no test coverage detected