| 433 | } |
| 434 | |
| 435 | struct 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 | |
| 455 | struct amount_sat psbt_output_get_amount(const struct wally_psbt *psbt, |
| 456 | size_t out) |
no test coverage detected