@@ -1059,7 +1059,10 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
1059
1059
cmp::max(self.config.options.cltv_expiry_delta, MIN_CLTV_EXPIRY_DELTA)
1060
1060
}
1061
1061
1062
- pub fn get_max_dust_htlc_exposure_msat ( & self ) -> u64 {
1062
+ pub fn get_max_dust_htlc_exposure_msat<F: Deref>(&self,
1063
+ _fee_estimator: &LowerBoundedFeeEstimator<F>) -> u64
1064
+ where F::Target: FeeEstimator
1065
+ {
1063
1066
match self.config.options.max_dust_htlc_exposure {
1064
1067
MaxDustHTLCExposure::FixedLimitMsat(limit) => limit,
1065
1068
MaxDustHTLCExposure::FeeRateMultiplier(_) => 5_000_000,
@@ -1536,7 +1539,10 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
1536
1539
/// Doesn't bother handling the
1537
1540
/// if-we-removed-it-already-but-haven't-fully-resolved-they-can-still-send-an-inbound-HTLC
1538
1541
/// corner case properly.
1539
- pub fn get_available_balances ( & self ) -> AvailableBalances {
1542
+ pub fn get_available_balances<F: Deref>(&self, fee_estimator: &LowerBoundedFeeEstimator<F>)
1543
+ -> AvailableBalances
1544
+ where F::Target: FeeEstimator
1545
+ {
1540
1546
let context = &self;
1541
1547
// Note that we have to handle overflow due to the above case.
1542
1548
let inbound_stats = context.get_inbound_pending_htlc_stats(None);
@@ -1618,6 +1624,7 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
1618
1624
// send above the dust limit (as the router can always overpay to meet the dust limit).
1619
1625
let mut remaining_msat_below_dust_exposure_limit = None;
1620
1626
let mut dust_exposure_dust_limit_msat = 0;
1627
+ let max_dust_htlc_exposure_msat = context.get_max_dust_htlc_exposure_msat(fee_estimator);
1621
1628
1622
1629
let (htlc_success_dust_limit, htlc_timeout_dust_limit) = if context.get_channel_type().supports_anchors_zero_fee_htlc_tx() {
1623
1630
(context.counterparty_dust_limit_satoshis, context.holder_dust_limit_satoshis)
@@ -1627,17 +1634,17 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
1627
1634
context.holder_dust_limit_satoshis + dust_buffer_feerate * htlc_timeout_tx_weight(context.get_channel_type()) / 1000)
1628
1635
};
1629
1636
let on_counterparty_dust_htlc_exposure_msat = inbound_stats.on_counterparty_tx_dust_exposure_msat + outbound_stats.on_counterparty_tx_dust_exposure_msat;
1630
- if on_counterparty_dust_htlc_exposure_msat as i64 + htlc_success_dust_limit as i64 * 1000 - 1 > context . get_max_dust_htlc_exposure_msat ( ) as i64 {
1637
+ if on_counterparty_dust_htlc_exposure_msat as i64 + htlc_success_dust_limit as i64 * 1000 - 1 > max_dust_htlc_exposure_msat as i64 {
1631
1638
remaining_msat_below_dust_exposure_limit =
1632
- Some ( context . get_max_dust_htlc_exposure_msat ( ) . saturating_sub ( on_counterparty_dust_htlc_exposure_msat) ) ;
1639
+ Some(max_dust_htlc_exposure_msat .saturating_sub(on_counterparty_dust_htlc_exposure_msat));
1633
1640
dust_exposure_dust_limit_msat = cmp::max(dust_exposure_dust_limit_msat, htlc_success_dust_limit * 1000);
1634
1641
}
1635
1642
1636
1643
let on_holder_dust_htlc_exposure_msat = inbound_stats.on_holder_tx_dust_exposure_msat + outbound_stats.on_holder_tx_dust_exposure_msat;
1637
- if on_holder_dust_htlc_exposure_msat as i64 + htlc_timeout_dust_limit as i64 * 1000 - 1 > context . get_max_dust_htlc_exposure_msat ( ) as i64 {
1644
+ if on_holder_dust_htlc_exposure_msat as i64 + htlc_timeout_dust_limit as i64 * 1000 - 1 > max_dust_htlc_exposure_msat as i64 {
1638
1645
remaining_msat_below_dust_exposure_limit = Some(cmp::min(
1639
1646
remaining_msat_below_dust_exposure_limit.unwrap_or(u64::max_value()),
1640
- context . get_max_dust_htlc_exposure_msat ( ) . saturating_sub ( on_holder_dust_htlc_exposure_msat) ) ) ;
1647
+ max_dust_htlc_exposure_msat .saturating_sub(on_holder_dust_htlc_exposure_msat)));
1641
1648
dust_exposure_dust_limit_msat = cmp::max(dust_exposure_dust_limit_msat, htlc_timeout_dust_limit * 1000);
1642
1649
}
1643
1650
@@ -2555,8 +2562,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
2555
2562
Ok(self.get_announcement_sigs(node_signer, genesis_block_hash, user_config, best_block.height(), logger))
2556
2563
}
2557
2564
2558
- pub fn update_add_htlc < F , L : Deref > ( & mut self , msg : & msgs:: UpdateAddHTLC , mut pending_forward_status : PendingHTLCStatus , create_pending_htlc_status : F , logger : & L ) -> Result < ( ) , ChannelError >
2559
- where F : for < ' a > Fn ( & ' a Self , PendingHTLCStatus , u16 ) -> PendingHTLCStatus , L :: Target : Logger {
2565
+ pub fn update_add_htlc<F, FE: Deref, L: Deref>(
2566
+ &mut self, msg: &msgs::UpdateAddHTLC, mut pending_forward_status: PendingHTLCStatus,
2567
+ create_pending_htlc_status: F, fee_estimator: &LowerBoundedFeeEstimator<FE>, logger: &L
2568
+ ) -> Result<(), ChannelError>
2569
+ where F: for<'a> Fn(&'a Self, PendingHTLCStatus, u16) -> PendingHTLCStatus,
2570
+ FE::Target: FeeEstimator, L::Target: Logger,
2571
+ {
2560
2572
// We can't accept HTLCs sent after we've sent a shutdown.
2561
2573
let local_sent_shutdown = (self.context.channel_state & (ChannelState::ChannelReady as u32 | ChannelState::LocalShutdownSent as u32)) != (ChannelState::ChannelReady as u32);
2562
2574
if local_sent_shutdown {
@@ -2609,6 +2621,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
2609
2621
}
2610
2622
}
2611
2623
2624
+ let max_dust_htlc_exposure_msat = self.context.get_max_dust_htlc_exposure_msat(fee_estimator);
2612
2625
let (htlc_timeout_dust_limit, htlc_success_dust_limit) = if self.context.get_channel_type().supports_anchors_zero_fee_htlc_tx() {
2613
2626
(0, 0)
2614
2627
} else {
@@ -2619,19 +2632,19 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
2619
2632
let exposure_dust_limit_timeout_sats = htlc_timeout_dust_limit + self.context.counterparty_dust_limit_satoshis;
2620
2633
if msg.amount_msat / 1000 < exposure_dust_limit_timeout_sats {
2621
2634
let on_counterparty_tx_dust_htlc_exposure_msat = inbound_stats.on_counterparty_tx_dust_exposure_msat + outbound_stats.on_counterparty_tx_dust_exposure_msat + msg.amount_msat;
2622
- if on_counterparty_tx_dust_htlc_exposure_msat > self . context . get_max_dust_htlc_exposure_msat ( ) {
2635
+ if on_counterparty_tx_dust_htlc_exposure_msat > max_dust_htlc_exposure_msat {
2623
2636
log_info!(logger, "Cannot accept value that would put our exposure to dust HTLCs at {} over the limit {} on counterparty commitment tx",
2624
- on_counterparty_tx_dust_htlc_exposure_msat, self . context . get_max_dust_htlc_exposure_msat ( ) ) ;
2637
+ on_counterparty_tx_dust_htlc_exposure_msat, max_dust_htlc_exposure_msat );
2625
2638
pending_forward_status = create_pending_htlc_status(self, pending_forward_status, 0x1000|7);
2626
2639
}
2627
2640
}
2628
2641
2629
2642
let exposure_dust_limit_success_sats = htlc_success_dust_limit + self.context.holder_dust_limit_satoshis;
2630
2643
if msg.amount_msat / 1000 < exposure_dust_limit_success_sats {
2631
2644
let on_holder_tx_dust_htlc_exposure_msat = inbound_stats.on_holder_tx_dust_exposure_msat + outbound_stats.on_holder_tx_dust_exposure_msat + msg.amount_msat;
2632
- if on_holder_tx_dust_htlc_exposure_msat > self . context . get_max_dust_htlc_exposure_msat ( ) {
2645
+ if on_holder_tx_dust_htlc_exposure_msat > max_dust_htlc_exposure_msat {
2633
2646
log_info!(logger, "Cannot accept value that would put our exposure to dust HTLCs at {} over the limit {} on holder commitment tx",
2634
- on_holder_tx_dust_htlc_exposure_msat, self . context . get_max_dust_htlc_exposure_msat ( ) ) ;
2647
+ on_holder_tx_dust_htlc_exposure_msat, max_dust_htlc_exposure_msat );
2635
2648
pending_forward_status = create_pending_htlc_status(self, pending_forward_status, 0x1000|7);
2636
2649
}
2637
2650
}
@@ -2998,16 +3011,24 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
2998
3011
/// Public version of the below, checking relevant preconditions first.
2999
3012
/// If we're not in a state where freeing the holding cell makes sense, this is a no-op and
3000
3013
/// returns `(None, Vec::new())`.
3001
- pub fn maybe_free_holding_cell_htlcs < L : Deref > ( & mut self , logger : & L ) -> ( Option < ChannelMonitorUpdate > , Vec < ( HTLCSource , PaymentHash ) > ) where L :: Target : Logger {
3014
+ pub fn maybe_free_holding_cell_htlcs<F: Deref, L: Deref>(
3015
+ &mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3016
+ ) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
3017
+ where F::Target: FeeEstimator, L::Target: Logger
3018
+ {
3002
3019
if self.context.channel_state >= ChannelState::ChannelReady as u32 &&
3003
3020
(self.context.channel_state & (ChannelState::AwaitingRemoteRevoke as u32 | ChannelState::PeerDisconnected as u32 | ChannelState::MonitorUpdateInProgress as u32)) == 0 {
3004
- self . free_holding_cell_htlcs ( logger)
3021
+ self.free_holding_cell_htlcs(fee_estimator, logger)
3005
3022
} else { (None, Vec::new()) }
3006
3023
}
3007
3024
3008
3025
/// Frees any pending commitment updates in the holding cell, generating the relevant messages
3009
3026
/// for our counterparty.
3010
- fn free_holding_cell_htlcs < L : Deref > ( & mut self , logger : & L ) -> ( Option < ChannelMonitorUpdate > , Vec < ( HTLCSource , PaymentHash ) > ) where L :: Target : Logger {
3027
+ fn free_holding_cell_htlcs<F: Deref, L: Deref>(
3028
+ &mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3029
+ ) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
3030
+ where F::Target: FeeEstimator, L::Target: Logger
3031
+ {
3011
3032
assert_eq!(self.context.channel_state & ChannelState::MonitorUpdateInProgress as u32, 0);
3012
3033
if self.context.holding_cell_htlc_updates.len() != 0 || self.context.holding_cell_update_fee.is_some() {
3013
3034
log_trace!(logger, "Freeing holding cell with {} HTLC updates{} in channel {}", self.context.holding_cell_htlc_updates.len(),
@@ -3036,7 +3057,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3036
3057
skimmed_fee_msat, ..
3037
3058
} => {
3038
3059
match self.send_htlc(amount_msat, *payment_hash, cltv_expiry, source.clone(),
3039
- onion_routing_packet. clone ( ) , false , skimmed_fee_msat, logger)
3060
+ onion_routing_packet.clone(), false, skimmed_fee_msat, fee_estimator, logger)
3040
3061
{
3041
3062
Ok(update_add_msg_option) => update_add_htlcs.push(update_add_msg_option.unwrap()),
3042
3063
Err(e) => {
@@ -3096,7 +3117,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3096
3117
return (None, htlcs_to_fail);
3097
3118
}
3098
3119
let update_fee = if let Some(feerate) = self.context.holding_cell_update_fee.take() {
3099
- self . send_update_fee ( feerate, false , logger)
3120
+ self.send_update_fee(feerate, false, fee_estimator, logger)
3100
3121
} else {
3101
3122
None
3102
3123
};
@@ -3123,8 +3144,10 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3123
3144
/// waiting on this revoke_and_ack. The generation of this new commitment_signed may also fail,
3124
3145
/// generating an appropriate error *after* the channel state has been updated based on the
3125
3146
/// revoke_and_ack message.
3126
- pub fn revoke_and_ack < L : Deref > ( & mut self , msg : & msgs:: RevokeAndACK , logger : & L ) -> Result < ( Vec < ( HTLCSource , PaymentHash ) > , Option < ChannelMonitorUpdate > ) , ChannelError >
3127
- where L :: Target : Logger ,
3147
+ pub fn revoke_and_ack<F: Deref, L: Deref>(&mut self, msg: &msgs::RevokeAndACK,
3148
+ fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3149
+ ) -> Result<(Vec<(HTLCSource, PaymentHash)>, Option<ChannelMonitorUpdate>), ChannelError>
3150
+ where F::Target: FeeEstimator, L::Target: Logger,
3128
3151
{
3129
3152
if (self.context.channel_state & (ChannelState::ChannelReady as u32)) != (ChannelState::ChannelReady as u32) {
3130
3153
return Err(ChannelError::Close("Got revoke/ACK message when channel was not in an operational state".to_owned()));
@@ -3324,7 +3347,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3324
3347
return Ok((Vec::new(), self.push_ret_blockable_mon_update(monitor_update)));
3325
3348
}
3326
3349
3327
- match self . free_holding_cell_htlcs ( logger) {
3350
+ match self.free_holding_cell_htlcs(fee_estimator, logger) {
3328
3351
(Some(mut additional_update), htlcs_to_fail) => {
3329
3352
// free_holding_cell_htlcs may bump latest_monitor_id multiple times but we want them to be
3330
3353
// strictly increasing by one, so decrement it here.
@@ -3359,8 +3382,11 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3359
3382
/// Queues up an outbound update fee by placing it in the holding cell. You should call
3360
3383
/// [`Self::maybe_free_holding_cell_htlcs`] in order to actually generate and send the
3361
3384
/// commitment update.
3362
- pub fn queue_update_fee < L : Deref > ( & mut self , feerate_per_kw : u32 , logger : & L ) where L :: Target : Logger {
3363
- let msg_opt = self . send_update_fee ( feerate_per_kw, true , logger) ;
3385
+ pub fn queue_update_fee<F: Deref, L: Deref>(&mut self, feerate_per_kw: u32,
3386
+ fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L)
3387
+ where F::Target: FeeEstimator, L::Target: Logger
3388
+ {
3389
+ let msg_opt = self.send_update_fee(feerate_per_kw, true, fee_estimator, logger);
3364
3390
assert!(msg_opt.is_none(), "We forced holding cell?");
3365
3391
}
3366
3392
@@ -3371,7 +3397,12 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3371
3397
///
3372
3398
/// You MUST call [`Self::send_commitment_no_state_update`] prior to any other calls on this
3373
3399
/// [`Channel`] if `force_holding_cell` is false.
3374
- fn send_update_fee < L : Deref > ( & mut self , feerate_per_kw : u32 , mut force_holding_cell : bool , logger : & L ) -> Option < msgs:: UpdateFee > where L :: Target : Logger {
3400
+ fn send_update_fee<F: Deref, L: Deref>(
3401
+ &mut self, feerate_per_kw: u32, mut force_holding_cell: bool,
3402
+ fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3403
+ ) -> Option<msgs::UpdateFee>
3404
+ where F::Target: FeeEstimator, L::Target: Logger
3405
+ {
3375
3406
if !self.context.is_outbound() {
3376
3407
panic!("Cannot send fee from inbound channel");
3377
3408
}
@@ -3398,11 +3429,12 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3398
3429
// Note, we evaluate pending htlc "preemptive" trimmed-to-dust threshold at the proposed `feerate_per_kw`.
3399
3430
let holder_tx_dust_exposure = inbound_stats.on_holder_tx_dust_exposure_msat + outbound_stats.on_holder_tx_dust_exposure_msat;
3400
3431
let counterparty_tx_dust_exposure = inbound_stats.on_counterparty_tx_dust_exposure_msat + outbound_stats.on_counterparty_tx_dust_exposure_msat;
3401
- if holder_tx_dust_exposure > self . context . get_max_dust_htlc_exposure_msat ( ) {
3432
+ let max_dust_htlc_exposure_msat = self.context.get_max_dust_htlc_exposure_msat(fee_estimator);
3433
+ if holder_tx_dust_exposure > max_dust_htlc_exposure_msat {
3402
3434
log_debug!(logger, "Cannot afford to send new feerate at {} without infringing max dust htlc exposure", feerate_per_kw);
3403
3435
return None;
3404
3436
}
3405
- if counterparty_tx_dust_exposure > self . context . get_max_dust_htlc_exposure_msat ( ) {
3437
+ if counterparty_tx_dust_exposure > max_dust_htlc_exposure_msat {
3406
3438
log_debug!(logger, "Cannot afford to send new feerate at {} without infringing max dust htlc exposure", feerate_per_kw);
3407
3439
return None;
3408
3440
}
@@ -3633,11 +3665,12 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3633
3665
let outbound_stats = self.context.get_outbound_pending_htlc_stats(None);
3634
3666
let holder_tx_dust_exposure = inbound_stats.on_holder_tx_dust_exposure_msat + outbound_stats.on_holder_tx_dust_exposure_msat;
3635
3667
let counterparty_tx_dust_exposure = inbound_stats.on_counterparty_tx_dust_exposure_msat + outbound_stats.on_counterparty_tx_dust_exposure_msat;
3636
- if holder_tx_dust_exposure > self . context . get_max_dust_htlc_exposure_msat ( ) {
3668
+ let max_dust_htlc_exposure_msat = self.context.get_max_dust_htlc_exposure_msat(fee_estimator);
3669
+ if holder_tx_dust_exposure > max_dust_htlc_exposure_msat {
3637
3670
return Err(ChannelError::Close(format!("Peer sent update_fee with a feerate ({}) which may over-expose us to dust-in-flight on our own transactions (totaling {} msat)",
3638
3671
msg.feerate_per_kw, holder_tx_dust_exposure)));
3639
3672
}
3640
- if counterparty_tx_dust_exposure > self . context . get_max_dust_htlc_exposure_msat ( ) {
3673
+ if counterparty_tx_dust_exposure > max_dust_htlc_exposure_msat {
3641
3674
return Err(ChannelError::Close(format!("Peer sent update_fee with a feerate ({}) which may over-expose us to dust-in-flight on our counterparty's transactions (totaling {} msat)",
3642
3675
msg.feerate_per_kw, counterparty_tx_dust_exposure)));
3643
3676
}
@@ -4991,13 +5024,16 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
4991
5024
/// commitment update.
4992
5025
///
4993
5026
/// `Err`s will only be [`ChannelError::Ignore`].
4994
- pub fn queue_add_htlc < L : Deref > (
5027
+ pub fn queue_add_htlc<F: Deref, L: Deref>(
4995
5028
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32, source: HTLCSource,
4996
- onion_routing_packet : msgs:: OnionPacket , skimmed_fee_msat : Option < u64 > , logger : & L
4997
- ) -> Result < ( ) , ChannelError > where L :: Target : Logger {
5029
+ onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
5030
+ fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
5031
+ ) -> Result<(), ChannelError>
5032
+ where F::Target: FeeEstimator, L::Target: Logger
5033
+ {
4998
5034
self
4999
5035
.send_htlc(amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, true,
5000
- skimmed_fee_msat, logger)
5036
+ skimmed_fee_msat, fee_estimator, logger)
5001
5037
.map(|msg_opt| assert!(msg_opt.is_none(), "We forced holding cell?"))
5002
5038
.map_err(|err| {
5003
5039
if let ChannelError::Ignore(_) = err { /* fine */ }
@@ -5022,11 +5058,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5022
5058
/// on this [`Channel`] if `force_holding_cell` is false.
5023
5059
///
5024
5060
/// `Err`s will only be [`ChannelError::Ignore`].
5025
- fn send_htlc < L : Deref > (
5061
+ fn send_htlc<F: Deref, L: Deref>(
5026
5062
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32, source: HTLCSource,
5027
5063
onion_routing_packet: msgs::OnionPacket, mut force_holding_cell: bool,
5028
- skimmed_fee_msat : Option < u64 > , logger : & L
5029
- ) -> Result < Option < msgs:: UpdateAddHTLC > , ChannelError > where L :: Target : Logger {
5064
+ skimmed_fee_msat: Option<u64>, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
5065
+ ) -> Result<Option<msgs::UpdateAddHTLC>, ChannelError>
5066
+ where F::Target: FeeEstimator, L::Target: Logger
5067
+ {
5030
5068
if (self.context.channel_state & (ChannelState::ChannelReady as u32 | BOTH_SIDES_SHUTDOWN_MASK)) != (ChannelState::ChannelReady as u32) {
5031
5069
return Err(ChannelError::Ignore("Cannot send HTLC until channel is fully established and we haven't started shutting down".to_owned()));
5032
5070
}
@@ -5039,7 +5077,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5039
5077
return Err(ChannelError::Ignore("Cannot send 0-msat HTLC".to_owned()));
5040
5078
}
5041
5079
5042
- let available_balances = self . context . get_available_balances ( ) ;
5080
+ let available_balances = self.context.get_available_balances(fee_estimator );
5043
5081
if amount_msat < available_balances.next_outbound_htlc_minimum_msat {
5044
5082
return Err(ChannelError::Ignore(format!("Cannot send less than our next-HTLC minimum - {} msat",
5045
5083
available_balances.next_outbound_htlc_minimum_msat)));
@@ -5239,12 +5277,15 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5239
5277
///
5240
5278
/// Shorthand for calling [`Self::send_htlc`] followed by a commitment update, see docs on
5241
5279
/// [`Self::send_htlc`] and [`Self::build_commitment_no_state_update`] for more info.
5242
- pub fn send_htlc_and_commit < L : Deref > (
5243
- & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
5244
- onion_routing_packet : msgs:: OnionPacket , skimmed_fee_msat : Option < u64 > , logger : & L
5245
- ) -> Result < Option < ChannelMonitorUpdate > , ChannelError > where L :: Target : Logger {
5280
+ pub fn send_htlc_and_commit<F: Deref, L: Deref>(
5281
+ &mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
5282
+ source: HTLCSource, onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
5283
+ fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
5284
+ ) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
5285
+ where F::Target: FeeEstimator, L::Target: Logger
5286
+ {
5246
5287
let send_res = self.send_htlc(amount_msat, payment_hash, cltv_expiry, source,
5247
- onion_routing_packet, false , skimmed_fee_msat, logger) ;
5288
+ onion_routing_packet, false, skimmed_fee_msat, fee_estimator, logger);
5248
5289
if let Err(e) = &send_res { if let ChannelError::Ignore(_) = e {} else { debug_assert!(false, "Sending cannot trigger channel failure"); } }
5249
5290
match send_res? {
5250
5291
Some(_) => {
0 commit comments