@@ -5517,10 +5517,15 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
5517
5517
let channel_type = Self::get_initial_channel_type(&config, their_features);
5518
5518
debug_assert!(channel_type.is_subset(&channelmanager::provided_channel_type_features(&config)));
5519
5519
5520
- let feerate = fee_estimator.bounded_sat_per_1000_weight(ConfirmationTarget::Normal);
5520
+ let commitment_conf_target = if channel_type.supports_anchors_zero_fee_htlc_tx() {
5521
+ ConfirmationTarget::MempoolMinimum
5522
+ } else {
5523
+ ConfirmationTarget::Normal
5524
+ };
5525
+ let commitment_feerate = fee_estimator.bounded_sat_per_1000_weight(commitment_conf_target);
5521
5526
5522
5527
let value_to_self_msat = channel_value_satoshis * 1000 - push_msat;
5523
- let commitment_tx_fee = commit_tx_fee_msat(feerate , MIN_AFFORDABLE_HTLC_COUNT, &channel_type);
5528
+ let commitment_tx_fee = commit_tx_fee_msat(commitment_feerate , MIN_AFFORDABLE_HTLC_COUNT, &channel_type);
5524
5529
if value_to_self_msat < commitment_tx_fee {
5525
5530
return Err(APIError::APIMisuseError{ err: format!("Funding amount ({}) can't even pay fee for initial commitment transaction fee of {}.", value_to_self_msat / 1000, commitment_tx_fee / 1000) });
5526
5531
}
@@ -5614,7 +5619,7 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
5614
5619
short_channel_id: None,
5615
5620
channel_creation_height: current_chain_height,
5616
5621
5617
- feerate_per_kw: feerate ,
5622
+ feerate_per_kw: commitment_feerate ,
5618
5623
counterparty_dust_limit_satoshis: 0,
5619
5624
holder_dust_limit_satoshis: MIN_CHAN_DUST_LIMIT_SATOSHIS,
5620
5625
counterparty_max_htlc_value_in_flight_msat: 0,
@@ -5768,7 +5773,12 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
5768
5773
/// If we receive an error message, it may only be a rejection of the channel type we tried,
5769
5774
/// not of our ability to open any channel at all. Thus, on error, we should first call this
5770
5775
/// and see if we get a new `OpenChannel` message, otherwise the channel is failed.
5771
- pub(crate) fn maybe_handle_error_without_close(&mut self, chain_hash: BlockHash) -> Result<msgs::OpenChannel, ()> {
5776
+ pub(crate) fn maybe_handle_error_without_close<F: Deref>(
5777
+ &mut self, chain_hash: BlockHash, fee_estimator: &LowerBoundedFeeEstimator<F>
5778
+ ) -> Result<msgs::OpenChannel, ()>
5779
+ where
5780
+ F::Target: FeeEstimator
5781
+ {
5772
5782
if !self.context.is_outbound() || self.context.channel_state != ChannelState::OurInitSent as u32 { return Err(()); }
5773
5783
if self.context.channel_type == ChannelTypeFeatures::only_static_remote_key() {
5774
5784
// We've exhausted our options
@@ -5785,6 +5795,7 @@ impl<Signer: WriteableEcdsaChannelSigner> OutboundV1Channel<Signer> {
5785
5795
// whatever reason.
5786
5796
if self.context.channel_type.supports_anchors_zero_fee_htlc_tx() {
5787
5797
self.context.channel_type.clear_anchors_zero_fee_htlc_tx();
5798
+ self.context.feerate_per_kw = fee_estimator.bounded_sat_per_1000_weight(ConfirmationTarget::Normal);
5788
5799
assert!(!self.context.channel_transaction_parameters.channel_type_features.supports_anchors_nonzero_fee_htlc_tx());
5789
5800
} else if self.context.channel_type.supports_scid_privacy() {
5790
5801
self.context.channel_type.clear_scid_privacy();
0 commit comments