FundingBatchClosure,
/// One of our HTLCs timed out in a channel, causing us to force close the channel.
HTLCsTimedOut,
+ /// Our peer provided a feerate which violated our required minimum (fetched from our
+ /// [`FeeEstimator`] either as [`ConfirmationTarget::MinAllowedAnchorChannelRemoteFee`] or
+ /// [`ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee`]).
+ ///
+ /// [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator
+ /// [`ConfirmationTarget::MinAllowedAnchorChannelRemoteFee`]: crate::chain::chaininterface::ConfirmationTarget::MinAllowedAnchorChannelRemoteFee
+ /// [`ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee`]: crate::chain::chaininterface::ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee
+ PeerFeerateTooLow {
+ /// The feerate on our channel set by our peer.
+ peer_feerate_sat_per_kw: u32,
+ /// The required feerate we enforce, from our [`FeeEstimator`].
+ ///
+ /// [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator
+ required_feerate_sat_per_kw: u32,
+ },
}
impl core::fmt::Display for ClosureReason {
ClosureReason::CounterpartyCoopClosedUnfundedChannel => f.write_str("the peer requested the unfunded channel be closed"),
ClosureReason::FundingBatchClosure => f.write_str("another channel in the same funding batch closed"),
ClosureReason::HTLCsTimedOut => f.write_str("htlcs on the channel timed out"),
+ ClosureReason::PeerFeerateTooLow { peer_feerate_sat_per_kw, required_feerate_sat_per_kw } =>
+ f.write_fmt(format_args!(
+ "peer provided a feerate ({} sat/kw) which was below our lower bound ({} sat/kw)",
+ peer_feerate_sat_per_kw, required_feerate_sat_per_kw,
+ )),
}
}
}
(17, CounterpartyInitiatedCooperativeClosure) => {},
(19, LocallyInitiatedCooperativeClosure) => {},
(21, HTLCsTimedOut) => {},
+ (23, PeerFeerateTooLow) => {
+ (0, peer_feerate_sat_per_kw, required),
+ (2, required_feerate_sat_per_kw, required),
+ },
);
/// Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
return Ok(());
}
}
- return Err(ChannelError::close(format!("Peer's feerate much too low. Actual: {}. Our expected lower limit: {}", feerate_per_kw, lower_limit)));
+ return Err(ChannelError::Close((format!(
+ "Peer's feerate much too low. Actual: {}. Our expected lower limit: {}", feerate_per_kw, lower_limit
+ ), ClosureReason::PeerFeerateTooLow {
+ peer_feerate_sat_per_kw: feerate_per_kw,
+ required_feerate_sat_per_kw: lower_limit,
+ })));
}
Ok(())
}
match events[0] {
MessageSendEvent::UpdateHTLCs { updates: msgs::CommitmentUpdate { ref update_fee, .. }, .. } => {
nodes[1].node.handle_update_fee(&nodes[0].node.get_our_node_id(), update_fee.as_ref().unwrap());
- check_closed_event!(nodes[1], 1, ClosureReason::ProcessingError {
- err: "Peer's feerate much too low. Actual: 1000. Our expected lower limit: 5000".to_owned() },
- [nodes[0].node.get_our_node_id()], 100000);
+ check_closed_event!(nodes[1], 1, ClosureReason::PeerFeerateTooLow {
+ peer_feerate_sat_per_kw: 1000, required_feerate_sat_per_kw: 5000,
+ }, [nodes[0].node.get_our_node_id()], 100000);
check_closed_broadcast!(nodes[1], true);
check_added_monitors!(nodes[1], 1);
},