@@ -331,6 +331,21 @@ pub enum ClosureReason {
331
331
FundingBatchClosure ,
332
332
/// One of our HTLCs timed out in a channel, causing us to force close the channel.
333
333
HTLCsTimedOut ,
334
+ /// Our peer provided a feerate which violated our required minimum (fetched from our
335
+ /// [`FeeEstimator`] either as [`ConfirmationTarget::MinAllowedAnchorChannelRemoteFee`] or
336
+ /// [`ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee`]).
337
+ ///
338
+ /// [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator
339
+ /// [`ConfirmationTarget::MinAllowedAnchorChannelRemoteFee`]: crate::chain::chaininterface::ConfirmationTarget::MinAllowedAnchorChannelRemoteFee
340
+ /// [`ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee`]: crate::chain::chaininterface::ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee
341
+ PeerFeerateTooLow {
342
+ /// The feerate on our channel set by our peer.
343
+ peer_feerate_sat_per_kw : u32 ,
344
+ /// The required feerate we enforce, from our [`FeeEstimator`].
345
+ ///
346
+ /// [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator
347
+ required_feerate_sat_per_kw : u32 ,
348
+ } ,
334
349
}
335
350
336
351
impl core:: fmt:: Display for ClosureReason {
@@ -355,6 +370,11 @@ impl core::fmt::Display for ClosureReason {
355
370
ClosureReason :: CounterpartyCoopClosedUnfundedChannel => f. write_str ( "the peer requested the unfunded channel be closed" ) ,
356
371
ClosureReason :: FundingBatchClosure => f. write_str ( "another channel in the same funding batch closed" ) ,
357
372
ClosureReason :: HTLCsTimedOut => f. write_str ( "htlcs on the channel timed out" ) ,
373
+ ClosureReason :: PeerFeerateTooLow { peer_feerate_sat_per_kw, required_feerate_sat_per_kw } =>
374
+ f. write_fmt ( format_args ! (
375
+ "peer provided a feerate ({} sat/kw) which was below our lower bound ({} sat/kw)" ,
376
+ peer_feerate_sat_per_kw, required_feerate_sat_per_kw,
377
+ ) ) ,
358
378
}
359
379
}
360
380
}
@@ -373,6 +393,10 @@ impl_writeable_tlv_based_enum_upgradable!(ClosureReason,
373
393
( 17 , CounterpartyInitiatedCooperativeClosure ) => { } ,
374
394
( 19 , LocallyInitiatedCooperativeClosure ) => { } ,
375
395
( 21 , HTLCsTimedOut ) => { } ,
396
+ ( 23 , PeerFeerateTooLow ) => {
397
+ ( 0 , peer_feerate_sat_per_kw, required) ,
398
+ ( 2 , required_feerate_sat_per_kw, required) ,
399
+ } ,
376
400
) ;
377
401
378
402
/// Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
0 commit comments