@@ -330,6 +330,21 @@ pub enum ClosureReason {
330330 FundingBatchClosure ,
331331 /// One of our HTLCs timed out in a channel, causing us to force close the channel.
332332 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+ } ,
333348}
334349
335350impl core:: fmt:: Display for ClosureReason {
@@ -354,6 +369,11 @@ impl core::fmt::Display for ClosureReason {
354369 ClosureReason :: CounterpartyCoopClosedUnfundedChannel => f. write_str ( "the peer requested the unfunded channel be closed" ) ,
355370 ClosureReason :: FundingBatchClosure => f. write_str ( "another channel in the same funding batch closed" ) ,
356371 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+ ) ) ,
357377 }
358378 }
359379}
@@ -372,6 +392,10 @@ impl_writeable_tlv_based_enum_upgradable!(ClosureReason,
372392 ( 17 , CounterpartyInitiatedCooperativeClosure ) => { } ,
373393 ( 19 , LocallyInitiatedCooperativeClosure ) => { } ,
374394 ( 21 , HTLCsTimedOut ) => { } ,
395+ ( 23 , PeerFeerateTooLow ) => {
396+ ( 0 , peer_feerate_sat_per_kw, required) ,
397+ ( 2 , required_feerate_sat_per_kw, required) ,
398+ } ,
375399) ;
376400
377401/// Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
0 commit comments