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