From: Matt Corallo Date: Thu, 29 Aug 2024 22:47:32 +0000 (+0000) Subject: Drop bogus debug assertion that we don't overpay on fees X-Git-Tag: v0.0.124~1^2~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=b3644dcdb5d9b4e7f0c9d1f95bae7f9324215961;p=rust-lightning Drop bogus debug assertion that we don't overpay on fees We should always select at least as many coins as is required to meet the feerate target, but its perfectly fine if we overshoot. Specifically, we may overshoot deliberately if we choose to burn change to fee instead. --- diff --git a/lightning/src/events/bump_transaction.rs b/lightning/src/events/bump_transaction.rs index 5597836d3..2728e21fc 100644 --- a/lightning/src/events/bump_transaction.rs +++ b/lightning/src/events/bump_transaction.rs @@ -703,11 +703,9 @@ where let expected_package_fee = Amount::from_sat(fee_for_weight(package_target_feerate_sat_per_1000_weight, signed_tx_weight + commitment_tx.weight().to_wu())); - // Our fee should be within a 5% error margin of the expected fee based on the - // feerate and transaction weight and we should never pay less than required. - let fee_error_margin = expected_package_fee * 5 / 100; - assert!(package_fee >= expected_package_fee && - package_fee - fee_error_margin <= expected_package_fee); + // Our feerate should always be at least what we were seeking. It may overshoot if + // the coin selector burned funds to an OP_RETURN without a change output. + assert!(package_fee >= expected_package_fee); } log_info!(self.logger, "Broadcasting anchor transaction {} to bump channel close with txid {}", @@ -811,11 +809,9 @@ where let expected_signed_tx_fee = fee_for_weight(target_feerate_sat_per_1000_weight, signed_tx_weight); let signed_tx_fee = total_input_amount - htlc_tx.output.iter().map(|output| output.value.to_sat()).sum::(); - // Our fee should be within a 5% error margin of the expected fee based on the - // feerate and transaction weight and we should never pay less than required. - let fee_error_margin = expected_signed_tx_fee * 5 / 100; - assert!(signed_tx_fee >= expected_signed_tx_fee && - signed_tx_fee - fee_error_margin <= expected_signed_tx_fee); + // Our feerate should always be at least what we were seeking. It may overshoot if + // the coin selector burned funds to an OP_RETURN without a change output. + assert!(signed_tx_fee >= expected_signed_tx_fee); } log_info!(self.logger, "Broadcasting {}", log_tx!(htlc_tx));