]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Drop `ChannelMonitorUpdate::UpdateFailed` as its now unused
authorMatt Corallo <git@bluematt.me>
Wed, 30 Aug 2023 18:19:35 +0000 (18:19 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 21 Sep 2023 19:04:41 +0000 (19:04 +0000)
lightning/src/chain/chainmonitor.rs
lightning/src/chain/channelmonitor.rs
lightning/src/ln/channelmanager.rs

index 09f72c5948933f606cb82663e144fcd14a658f60..4e349799d1c201a834a686c34c69e96dcb5c7fc5 100644 (file)
@@ -44,7 +44,7 @@ use crate::prelude::*;
 use crate::sync::{RwLock, RwLockReadGuard, Mutex, MutexGuard};
 use core::iter::FromIterator;
 use core::ops::Deref;
-use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
+use core::sync::atomic::{AtomicUsize, Ordering};
 use bitcoin::secp256k1::PublicKey;
 
 #[derive(Clone, Copy, Hash, PartialEq, Eq)]
index 16a9901e4430cb78451410038c0cab2b0bb3c217..3e03c2fd541249e600f1d122661ab0161695f4f7 100644 (file)
@@ -150,13 +150,10 @@ pub enum MonitorEvent {
                /// same [`ChannelMonitor`] have been applied and persisted.
                monitor_update_id: u64,
        },
-
-       /// Indicates a [`ChannelMonitor`] update has failed.
-       UpdateFailed(OutPoint),
 }
 impl_writeable_tlv_based_enum_upgradable!(MonitorEvent,
-       // Note that Completed and UpdateFailed are currently never serialized to disk as they are
-       // generated only in ChainMonitor
+       // Note that Completed is currently never serialized to disk as it is generated only in
+       // ChainMonitor.
        (0, Completed) => {
                (0, funding_txo, required),
                (2, monitor_update_id, required),
@@ -164,7 +161,7 @@ impl_writeable_tlv_based_enum_upgradable!(MonitorEvent,
 ;
        (2, HTLCEvent),
        (4, CommitmentTxConfirmed),
-       (6, UpdateFailed),
+       // 6 was `UpdateFailed` until LDK 0.0.117
 );
 
 /// Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
index 35735c38926dff2dcc0c85a6e12ad7dc9b808651..b068b7a7496f54396da5843f86893c34449dcf49 100644 (file)
@@ -6729,8 +6729,7 @@ where
                                                        self.fail_htlc_backwards_internal(&htlc_update.source, &htlc_update.payment_hash, &reason, receiver);
                                                }
                                        },
-                                       MonitorEvent::CommitmentTxConfirmed(funding_outpoint) |
-                                       MonitorEvent::UpdateFailed(funding_outpoint) => {
+                                       MonitorEvent::CommitmentTxConfirmed(funding_outpoint) => {
                                                let counterparty_node_id_opt = match counterparty_node_id {
                                                        Some(cp_id) => Some(cp_id),
                                                        None => {
@@ -6754,12 +6753,7 @@ where
                                                                                                msg: update
                                                                                        });
                                                                                }
-                                                                               let reason = if let MonitorEvent::UpdateFailed(_) = monitor_event {
-                                                                                       ClosureReason::ProcessingError { err: "Failed to persist ChannelMonitor update during chain sync".to_string() }
-                                                                               } else {
-                                                                                       ClosureReason::CommitmentTxConfirmed
-                                                                               };
-                                                                               self.issue_channel_close_events(&chan.context, reason);
+                                                                               self.issue_channel_close_events(&chan.context, ClosureReason::CommitmentTxConfirmed);
                                                                                pending_msg_events.push(events::MessageSendEvent::HandleError {
                                                                                        node_id: chan.context.get_counterparty_node_id(),
                                                                                        action: msgs::ErrorAction::SendErrorMessage {