bdk_chain::bitcoin::blockdata::transaction

Function effective_value

pub fn effective_value(
    fee_rate: FeeRate,
    satisfaction_weight: Weight,
    value: Amount,
) -> Option<SignedAmount>
Expand description

Computes the value of an output accounting for the cost of spending it.

The effective value is the value of an output value minus the amount to spend it. That is, the effective_value can be calculated as: value - (fee_rate * weight).

Note: the effective value of a Transaction may increase less than the effective value of a TxOut when adding another TxOut to the transaction. This happens when the new TxOut added causes the output length VarInt to increase its encoding length.

ยงArguments

  • fee_rate - the fee rate of the transaction being created.
  • satisfaction_weight - satisfied spending conditions weight.