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

Function wally_psbt_output_get_amount

bitcoin/psbt.c:1068–1100  ·  view source on GitHub ↗

FIXME(cdecker) Make the caller pass in a reference to amount_asset, and * return false if unintelligible/encrypted. (WARN UNUSED). */

Source from the content-addressed store, hash-verified

1066/* FIXME(cdecker) Make the caller pass in a reference to amount_asset, and
1067 * return false if unintelligible/encrypted. (WARN UNUSED). */
1068struct amount_asset
1069wally_psbt_output_get_amount(const struct wally_psbt_output *output)
1070{
1071 struct amount_asset amount;
1072 size_t asset_out;
1073
1074 if (chainparams->is_elements) {
1075 if (wally_psbt_output_get_asset(output, amount.asset + 1, sizeof(amount.asset) - 1, &asset_out) != WALLY_OK) {
1076 amount.value = 0;
1077 return amount;
1078 }
1079 assert(asset_out == 32);
1080 amount.asset[0] = 0x01; /* explicit */
1081 /* We currently only support explicit value
1082 * asset tags, others are confidential, so
1083 * don't even try to assign a value to it. */
1084 if (output->has_amount == true) {
1085 amount.value = output->amount;
1086 } else {
1087 amount.value = 0;
1088 }
1089 } else {
1090 /* Do not assign amount.asset, we should never touch it in
1091 * non-elements scenarios. */
1092 if (output->has_amount) {
1093 amount.value = output->amount;
1094 } else {
1095 abort();
1096 }
1097 }
1098
1099 return amount;
1100}
1101
1102bool elements_psbt_output_is_fee(const struct wally_psbt *psbt, size_t outnum)
1103{

Callers 5

psbt_output_get_amountFunction · 0.85
psbt_compute_feeFunction · 0.85
send_nextFunction · 0.85
psbt_changeset_get_nextFunction · 0.85

Calls 1

abortFunction · 0.85

Tested by

no test coverage detected