@@ -1061,7 +1061,7 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
1061
1061
1062
1062
pub fn get_max_dust_htlc_exposure_msat<F: Deref>(&self,
1063
1063
_fee_estimator: &LowerBoundedFeeEstimator<F>) -> u64
1064
- where F::Target: FeeEstimator
1064
+ where F::Target: FeeEstimator
1065
1065
{
1066
1066
match self.config.options.max_dust_htlc_exposure_msat {
1067
1067
MaxDustHTLCExposure::FixedLimitMsat(limit) => limit,
@@ -1539,8 +1539,9 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
1539
1539
/// Doesn't bother handling the
1540
1540
/// if-we-removed-it-already-but-haven't-fully-resolved-they-can-still-send-an-inbound-HTLC
1541
1541
/// corner case properly.
1542
- pub fn get_available_balances<F: Deref>(&self, fee_estimator: &LowerBoundedFeeEstimator<F>) -> AvailableBalances
1543
- where F::Target: FeeEstimator
1542
+ pub fn get_available_balances<F: Deref>(&self, fee_estimator: &LowerBoundedFeeEstimator<F>)
1543
+ -> AvailableBalances
1544
+ where F::Target: FeeEstimator
1544
1545
{
1545
1546
let context = &self;
1546
1547
// Note that we have to handle overflow due to the above case.
@@ -2561,9 +2562,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
2561
2562
Ok(self.get_announcement_sigs(node_signer, genesis_block_hash, user_config, best_block.height(), logger))
2562
2563
}
2563
2564
2564
- pub fn update_add_htlc<F, FE: Deref, L: Deref>(&mut self, msg: &msgs::UpdateAddHTLC, mut pending_forward_status: PendingHTLCStatus, create_pending_htlc_status: F, fee_estimator: &LowerBoundedFeeEstimator<FE>, logger: &L) -> Result<(), ChannelError>
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>
2565
2569
where F: for<'a> Fn(&'a Self, PendingHTLCStatus, u16) -> PendingHTLCStatus,
2566
- FE::Target: FeeEstimator, L::Target: Logger {
2570
+ FE::Target: FeeEstimator, L::Target: Logger,
2571
+ {
2567
2572
// We can't accept HTLCs sent after we've sent a shutdown.
2568
2573
let local_sent_shutdown = (self.context.channel_state & (ChannelState::ChannelReady as u32 | ChannelState::LocalShutdownSent as u32)) != (ChannelState::ChannelReady as u32);
2569
2574
if local_sent_shutdown {
@@ -3006,7 +3011,11 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3006
3011
/// Public version of the below, checking relevant preconditions first.
3007
3012
/// If we're not in a state where freeing the holding cell makes sense, this is a no-op and
3008
3013
/// returns `(None, Vec::new())`.
3009
- pub fn maybe_free_holding_cell_htlcs<F: Deref, L: Deref>(&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>) where F::Target: FeeEstimator, 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
+ {
3010
3019
if self.context.channel_state >= ChannelState::ChannelReady as u32 &&
3011
3020
(self.context.channel_state & (ChannelState::AwaitingRemoteRevoke as u32 | ChannelState::PeerDisconnected as u32 | ChannelState::MonitorUpdateInProgress as u32)) == 0 {
3012
3021
self.free_holding_cell_htlcs(fee_estimator, logger)
@@ -3015,7 +3024,9 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3015
3024
3016
3025
/// Frees any pending commitment updates in the holding cell, generating the relevant messages
3017
3026
/// for our counterparty.
3018
- fn free_holding_cell_htlcs<F: Deref, L: Deref>(&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L) -> (Option<ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
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)>)
3019
3030
where F::Target: FeeEstimator, L::Target: Logger
3020
3031
{
3021
3032
assert_eq!(self.context.channel_state & ChannelState::MonitorUpdateInProgress as u32, 0);
@@ -3133,7 +3144,9 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3133
3144
/// waiting on this revoke_and_ack. The generation of this new commitment_signed may also fail,
3134
3145
/// generating an appropriate error *after* the channel state has been updated based on the
3135
3146
/// revoke_and_ack message.
3136
- pub fn revoke_and_ack<F: Deref, L: Deref>(&mut self, msg: &msgs::RevokeAndACK, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L) -> Result<(Vec<(HTLCSource, PaymentHash)>, Option<ChannelMonitorUpdate>), ChannelError>
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>
3137
3150
where F::Target: FeeEstimator, L::Target: Logger,
3138
3151
{
3139
3152
if (self.context.channel_state & (ChannelState::ChannelReady as u32)) != (ChannelState::ChannelReady as u32) {
@@ -3371,7 +3384,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3371
3384
/// commitment update.
3372
3385
pub fn queue_update_fee<F: Deref, L: Deref>(&mut self, feerate_per_kw: u32,
3373
3386
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L)
3374
- where F::Target: FeeEstimator, L::Target: Logger
3387
+ where F::Target: FeeEstimator, L::Target: Logger
3375
3388
{
3376
3389
let msg_opt = self.send_update_fee(feerate_per_kw, true, fee_estimator, logger);
3377
3390
assert!(msg_opt.is_none(), "We forced holding cell?");
@@ -3384,7 +3397,10 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3384
3397
///
3385
3398
/// You MUST call [`Self::send_commitment_no_state_update`] prior to any other calls on this
3386
3399
/// [`Channel`] if `force_holding_cell` is false.
3387
- fn send_update_fee<F: Deref, L: Deref>(&mut self, feerate_per_kw: u32, mut force_holding_cell: bool, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L) -> Option<msgs::UpdateFee>
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>
3388
3404
where F::Target: FeeEstimator, L::Target: Logger
3389
3405
{
3390
3406
if !self.context.is_outbound() {
@@ -5013,7 +5029,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5013
5029
onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
5014
5030
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
5015
5031
) -> Result<(), ChannelError>
5016
- where F::Target: FeeEstimator, L::Target: Logger
5032
+ where F::Target: FeeEstimator, L::Target: Logger
5017
5033
{
5018
5034
self
5019
5035
.send_htlc(amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, true,
@@ -5047,7 +5063,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5047
5063
onion_routing_packet: msgs::OnionPacket, mut force_holding_cell: bool,
5048
5064
skimmed_fee_msat: Option<u64>, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
5049
5065
) -> Result<Option<msgs::UpdateAddHTLC>, ChannelError>
5050
- where F::Target: FeeEstimator, L::Target: Logger
5066
+ where F::Target: FeeEstimator, L::Target: Logger
5051
5067
{
5052
5068
if (self.context.channel_state & (ChannelState::ChannelReady as u32 | BOTH_SIDES_SHUTDOWN_MASK)) != (ChannelState::ChannelReady as u32) {
5053
5069
return Err(ChannelError::Ignore("Cannot send HTLC until channel is fully established and we haven't started shutting down".to_owned()));
@@ -5262,8 +5278,8 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5262
5278
/// Shorthand for calling [`Self::send_htlc`] followed by a commitment update, see docs on
5263
5279
/// [`Self::send_htlc`] and [`Self::build_commitment_no_state_update`] for more info.
5264
5280
pub fn send_htlc_and_commit<F: Deref, L: Deref>(
5265
- &mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32, source: HTLCSource,
5266
- onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
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>,
5267
5283
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
5268
5284
) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
5269
5285
where F::Target: FeeEstimator, L::Target: Logger
0 commit comments