FIXME(cdecker) Make the caller pass in a reference to amount_asset, and * return false if unintelligible/encrypted. (WARN UNUSED). */
| 819 | /* FIXME(cdecker) Make the caller pass in a reference to amount_asset, and |
| 820 | * return false if unintelligible/encrypted. (WARN UNUSED). */ |
| 821 | struct amount_asset |
| 822 | wally_tx_output_get_amount(const struct wally_tx_output *output) |
| 823 | { |
| 824 | struct amount_asset amount; |
| 825 | be64 raw; |
| 826 | |
| 827 | if (chainparams->is_elements) { |
| 828 | assert(output->asset_len == sizeof(amount.asset)); |
| 829 | memcpy(&amount.asset, output->asset, sizeof(amount.asset)); |
| 830 | /* We currently only support explicit value |
| 831 | * asset tags, others are confidential, so |
| 832 | * don't even try to assign a value to it. */ |
| 833 | if (output->asset[0] == 0x01) { |
| 834 | memcpy(&raw, output->value + 1, sizeof(raw)); |
| 835 | amount.value = be64_to_cpu(raw); |
| 836 | } else { |
| 837 | amount.value = 0; |
| 838 | } |
| 839 | } else { |
| 840 | /* Do not assign amount.asset, we should never touch it in |
| 841 | * non-elements scenarios. */ |
| 842 | amount.value = output->satoshi; |
| 843 | } |
| 844 | |
| 845 | return amount; |
| 846 | } |
| 847 | |
| 848 | /* Various weights of transaction parts. */ |
| 849 | size_t bitcoin_tx_core_weight(size_t num_inputs, size_t num_outputs) |
no test coverage detected