- // account. We compute its feerate and subtract it from the package target, using the result
- // as the target feerate for our anchor transaction. Unfortunately, this results in users
- // overpaying by a small margin since we don't yet know the anchor transaction size, and
- // avoiding the small overpayment only makes our API even more complex.
- let commitment_tx_sat_per_1000_weight: u32 = compute_feerate_sat_per_1000_weight(
- commitment_tx_fee_sat, commitment_tx.weight() as u64,
- );
- let anchor_target_feerate_sat_per_1000_weight = core::cmp::max(
- package_target_feerate_sat_per_1000_weight - commitment_tx_sat_per_1000_weight,
- FEERATE_FLOOR_SATS_PER_KW,
- );
-
- log_debug!(self.logger, "Peforming coin selection for anchor transaction targeting {} sat/kW",
- anchor_target_feerate_sat_per_1000_weight);
+ // account. We do so by pretending the commitment tranasction's fee and weight are part of
+ // the anchor input.
+ let mut anchor_utxo = anchor_descriptor.previous_utxo();
+ anchor_utxo.value += commitment_tx_fee_sat;