@@ -1074,7 +1074,7 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
1074
1074
1075
1075
pub fn get_max_dust_htlc_exposure_msat<F: Deref>(&self,
1076
1076
_fee_estimator: &LowerBoundedFeeEstimator<F>) -> u64
1077
- where F::Target: FeeEstimator
1077
+ where F::Target: FeeEstimator
1078
1078
{
1079
1079
match self.config.options.max_dust_htlc_exposure_msat {
1080
1080
MaxDustHTLCExposure::FixedLimitMsat(limit) => limit,
@@ -1553,8 +1553,9 @@ impl<Signer: ChannelSigner> ChannelContext<Signer> {
1553
1553
/// Doesn't bother handling the
1554
1554
/// if-we-removed-it-already-but-haven't-fully-resolved-they-can-still-send-an-inbound-HTLC
1555
1555
/// corner case properly.
1556
- pub fn get_available_balances<F: Deref>(&self, fee_estimator: &LowerBoundedFeeEstimator<F>) -> AvailableBalances
1557
- where F::Target: FeeEstimator
1556
+ pub fn get_available_balances<F: Deref>(&self, fee_estimator: &LowerBoundedFeeEstimator<F>)
1557
+ -> AvailableBalances
1558
+ where F::Target: FeeEstimator
1558
1559
{
1559
1560
let context = &self;
1560
1561
// Note that we have to handle overflow due to the above case.
@@ -2588,9 +2589,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
2588
2589
Ok(self.get_announcement_sigs(node_signer, genesis_block_hash, user_config, best_block.height(), logger))
2589
2590
}
2590
2591
2591
- 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>
2592
+ pub fn update_add_htlc<F, FE: Deref, L: Deref>(
2593
+ &mut self, msg: &msgs::UpdateAddHTLC, mut pending_forward_status: PendingHTLCStatus,
2594
+ create_pending_htlc_status: F, fee_estimator: &LowerBoundedFeeEstimator<FE>, logger: &L
2595
+ ) -> Result<(), ChannelError>
2592
2596
where F: for<'a> Fn(&'a Self, PendingHTLCStatus, u16) -> PendingHTLCStatus,
2593
- FE::Target: FeeEstimator, L::Target: Logger {
2597
+ FE::Target: FeeEstimator, L::Target: Logger,
2598
+ {
2594
2599
// We can't accept HTLCs sent after we've sent a shutdown.
2595
2600
let local_sent_shutdown = (self.context.channel_state & (ChannelState::ChannelReady as u32 | ChannelState::LocalShutdownSent as u32)) != (ChannelState::ChannelReady as u32);
2596
2601
if local_sent_shutdown {
@@ -3033,7 +3038,11 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3033
3038
/// Public version of the below, checking relevant preconditions first.
3034
3039
/// If we're not in a state where freeing the holding cell makes sense, this is a no-op and
3035
3040
/// returns `(None, Vec::new())`.
3036
- 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 {
3041
+ pub fn maybe_free_holding_cell_htlcs<F: Deref, L: Deref>(
3042
+ &mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3043
+ ) -> (Option<&ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
3044
+ where F::Target: FeeEstimator, L::Target: Logger
3045
+ {
3037
3046
if self.context.channel_state >= ChannelState::ChannelReady as u32 &&
3038
3047
(self.context.channel_state & (ChannelState::AwaitingRemoteRevoke as u32 | ChannelState::PeerDisconnected as u32 | ChannelState::MonitorUpdateInProgress as u32)) == 0 {
3039
3048
self.free_holding_cell_htlcs(fee_estimator, logger)
@@ -3042,8 +3051,10 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3042
3051
3043
3052
/// Frees any pending commitment updates in the holding cell, generating the relevant messages
3044
3053
/// for our counterparty.
3045
- fn free_holding_cell_htlcs<F: Deref, L: Deref>(&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L) -> (Option<&ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
3046
- where F::Target: FeeEstimator, L::Target: Logger
3054
+ fn free_holding_cell_htlcs<F: Deref, L: Deref>(
3055
+ &mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3056
+ ) -> (Option<&ChannelMonitorUpdate>, Vec<(HTLCSource, PaymentHash)>)
3057
+ where F::Target: FeeEstimator, L::Target: Logger
3047
3058
{
3048
3059
assert_eq!(self.context.channel_state & ChannelState::MonitorUpdateInProgress as u32, 0);
3049
3060
if self.context.holding_cell_htlc_updates.len() != 0 || self.context.holding_cell_update_fee.is_some() {
@@ -3160,8 +3171,10 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3160
3171
/// waiting on this revoke_and_ack. The generation of this new commitment_signed may also fail,
3161
3172
/// generating an appropriate error *after* the channel state has been updated based on the
3162
3173
/// revoke_and_ack message.
3163
- 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>
3164
- where F::Target: FeeEstimator, L::Target: Logger,
3174
+ pub fn revoke_and_ack<F: Deref, L: Deref>(&mut self, msg: &msgs::RevokeAndACK,
3175
+ fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3176
+ ) -> Result<(Vec<(HTLCSource, PaymentHash)>, Option<&ChannelMonitorUpdate>), ChannelError>
3177
+ where F::Target: FeeEstimator, L::Target: Logger,
3165
3178
{
3166
3179
if (self.context.channel_state & (ChannelState::ChannelReady as u32)) != (ChannelState::ChannelReady as u32) {
3167
3180
return Err(ChannelError::Close("Got revoke/ACK message when channel was not in an operational state".to_owned()));
@@ -3399,7 +3412,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3399
3412
/// commitment update.
3400
3413
pub fn queue_update_fee<F: Deref, L: Deref>(&mut self, feerate_per_kw: u32,
3401
3414
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L)
3402
- where F::Target: FeeEstimator, L::Target: Logger
3415
+ where F::Target: FeeEstimator, L::Target: Logger
3403
3416
{
3404
3417
let msg_opt = self.send_update_fee(feerate_per_kw, true, fee_estimator, logger);
3405
3418
assert!(msg_opt.is_none(), "We forced holding cell?");
@@ -3412,7 +3425,10 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3412
3425
///
3413
3426
/// You MUST call [`Self::send_commitment_no_state_update`] prior to any other calls on this
3414
3427
/// [`Channel`] if `force_holding_cell` is false.
3415
- 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>
3428
+ fn send_update_fee<F: Deref, L: Deref>(
3429
+ &mut self, feerate_per_kw: u32, mut force_holding_cell: bool,
3430
+ fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
3431
+ ) -> Option<msgs::UpdateFee>
3416
3432
where F::Target: FeeEstimator, L::Target: Logger
3417
3433
{
3418
3434
if !self.context.is_outbound() {
@@ -5076,7 +5092,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5076
5092
onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
5077
5093
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
5078
5094
) -> Result<(), ChannelError>
5079
- where F::Target: FeeEstimator, L::Target: Logger
5095
+ where F::Target: FeeEstimator, L::Target: Logger
5080
5096
{
5081
5097
self
5082
5098
.send_htlc(amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, true,
@@ -5110,7 +5126,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5110
5126
onion_routing_packet: msgs::OnionPacket, mut force_holding_cell: bool,
5111
5127
skimmed_fee_msat: Option<u64>, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
5112
5128
) -> Result<Option<msgs::UpdateAddHTLC>, ChannelError>
5113
- where F::Target: FeeEstimator, L::Target: Logger
5129
+ where F::Target: FeeEstimator, L::Target: Logger
5114
5130
{
5115
5131
if (self.context.channel_state & (ChannelState::ChannelReady as u32 | BOTH_SIDES_SHUTDOWN_MASK)) != (ChannelState::ChannelReady as u32) {
5116
5132
return Err(ChannelError::Ignore("Cannot send HTLC until channel is fully established and we haven't started shutting down".to_owned()));
@@ -5325,11 +5341,11 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5325
5341
/// Shorthand for calling [`Self::send_htlc`] followed by a commitment update, see docs on
5326
5342
/// [`Self::send_htlc`] and [`Self::build_commitment_no_state_update`] for more info.
5327
5343
pub fn send_htlc_and_commit<F: Deref, L: Deref>(
5328
- &mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32, source: HTLCSource,
5329
- onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
5344
+ &mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
5345
+ source: HTLCSource, onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
5330
5346
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L
5331
5347
) -> Result<Option<&ChannelMonitorUpdate>, ChannelError>
5332
- where F::Target: FeeEstimator, L::Target: Logger
5348
+ where F::Target: FeeEstimator, L::Target: Logger
5333
5349
{
5334
5350
let send_res = self.send_htlc(amount_msat, payment_hash, cltv_expiry, source,
5335
5351
onion_routing_packet, false, skimmed_fee_msat, fee_estimator, logger);
0 commit comments