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

Function wally_tx_output_get_amount

bitcoin/tx.c:778–803  ·  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

776/* FIXME(cdecker) Make the caller pass in a reference to amount_asset, and
777 * return false if unintelligible/encrypted. (WARN UNUSED). */
778struct amount_asset
779wally_tx_output_get_amount(const struct wally_tx_output *output)
780{
781 struct amount_asset amount;
782 be64 raw;
783
784 if (chainparams->is_elements) {
785 assert(output->asset_len == sizeof(amount.asset));
786 memcpy(&amount.asset, output->asset, sizeof(amount.asset));
787 /* We currently only support explicit value
788 * asset tags, others are confidential, so
789 * don't even try to assign a value to it. */
790 if (output->asset[0] == 0x01) {
791 memcpy(&raw, output->value + 1, sizeof(raw));
792 amount.value = be64_to_cpu(raw);
793 } else {
794 amount.value = 0;
795 }
796 } else {
797 /* Do not assign amount.asset, we should never touch it in
798 * non-elements scenarios. */
799 amount.value = output->satoshi;
800 }
801
802 return amount;
803}
804
805/* Various weights of transaction parts. */
806size_t bitcoin_tx_core_weight(size_t num_inputs, size_t num_outputs)

Callers 15

trim_maximum_feerateFunction · 0.85
resolve_htlc_txFunction · 0.85
steal_htlc_txFunction · 0.85
handle_our_unilateralFunction · 0.85
tell_wallet_to_remoteFunction · 0.85
handle_their_cheatFunction · 0.85
handle_their_unilateralFunction · 0.85
tx_parts_from_wally_txFunction · 0.85
psbt_input_get_amountFunction · 0.85

Calls 1

be64_to_cpuFunction · 0.85

Tested by

no test coverage detected