Check we won't overflow `max_dust_htlc_exposure_msat` at outbound feerate update
[rust-lightning] / lightning / src / util / events.rs
index c021fe3c16b9dda30f7b8a75189d3785323fe2a2..6bbd6b9946ccc49e18ae7b85a715b23d2478f4ad 100644 (file)
@@ -16,6 +16,7 @@
 
 use chain::keysinterface::SpendableOutputDescriptor;
 use ln::channelmanager::PaymentId;
+use ln::channel::FUNDING_CONF_DEADLINE_BLOCKS;
 use ln::msgs;
 use ln::msgs::DecodeError;
 use ln::{PaymentPreimage, PaymentHash, PaymentSecret};
@@ -101,6 +102,8 @@ pub enum ClosureReason {
        /// commitment transaction came from our counterparty, but it may also have come from
        /// a copy of our own `ChannelMonitor`.
        CommitmentTxConfirmed,
+       /// The funding transaction failed to confirm in a timely manner on an inbound channel.
+       FundingTimedOut,
        /// Closure generated from processing an event, likely a HTLC forward/relay/reception.
        ProcessingError {
                /// A developer-readable error message which we generated.
@@ -129,6 +132,7 @@ impl core::fmt::Display for ClosureReason {
                        ClosureReason::HolderForceClosed => f.write_str("user manually force-closed the channel"),
                        ClosureReason::CooperativeClosure => f.write_str("the channel was cooperatively closed"),
                        ClosureReason::CommitmentTxConfirmed => f.write_str("commitment or closing transaction was confirmed on chain."),
+                       ClosureReason::FundingTimedOut => write!(f, "funding transaction failed to confirm within {} blocks", FUNDING_CONF_DEADLINE_BLOCKS),
                        ClosureReason::ProcessingError { err } => {
                                f.write_str("of an exception: ")?;
                                f.write_str(&err)
@@ -141,6 +145,7 @@ impl core::fmt::Display for ClosureReason {
 
 impl_writeable_tlv_based_enum_upgradable!(ClosureReason,
        (0, CounterpartyForceClosed) => { (1, peer_msg, required) },
+       (1, FundingTimedOut) => {},
        (2, HolderForceClosed) => {},
        (6, CommitmentTxConfirmed) => {},
        (4, CooperativeClosure) => {},