@@ -179,12 +179,6 @@ struct MonitorHolder<ChannelSigner: WriteableEcdsaChannelSigner> {
179179 /// the ChannelManager re-adding the same payment entry, before the same block is replayed,
180180 /// resulting in a duplicate PaymentSent event.
181181 pending_monitor_updates : Mutex < Vec < MonitorUpdateId > > ,
182- /// When the user returns a PermanentFailure error from an update_persisted_channel call during
183- /// block processing, we inform the ChannelManager that the channel should be closed
184- /// asynchronously. In order to ensure no further changes happen before the ChannelManager has
185- /// processed the closure event, we set this to true and return PermanentFailure for any other
186- /// chain::Watch events.
187- channel_perm_failed : AtomicBool ,
188182 /// The last block height at which no [`UpdateOrigin::ChainSync`] monitor updates were present
189183 /// in `pending_monitor_updates`.
190184 /// If it's been more than [`LATENCY_GRACE_PERIOD_BLOCKS`] since we started waiting on a chain
@@ -485,9 +479,8 @@ where C::Target: chain::Filter,
485479 // `MonitorEvent`s from the monitor back to the `ChannelManager` until they
486480 // complete.
487481 let monitor_is_pending_updates = monitor_data. has_pending_offchain_updates ( & pending_monitor_updates) ;
488- if monitor_is_pending_updates || monitor_data. channel_perm_failed . load ( Ordering :: Acquire ) {
489- // If there are still monitor updates pending (or an old monitor update
490- // finished after a later one perm-failed), we cannot yet construct an
482+ if monitor_is_pending_updates {
483+ // If there are still monitor updates pending, we cannot yet construct a
491484 // Completed event.
492485 return Ok ( ( ) ) ;
493486 }
@@ -695,7 +688,6 @@ where C::Target: chain::Filter,
695688 entry. insert ( MonitorHolder {
696689 monitor,
697690 pending_monitor_updates : Mutex :: new ( pending_monitor_updates) ,
698- channel_perm_failed : AtomicBool :: new ( false ) ,
699691 last_chain_persist_height : AtomicUsize :: new ( self . highest_chain_height . load ( Ordering :: Acquire ) ) ,
700692 } ) ;
701693 Ok ( persist_res)
@@ -741,8 +733,6 @@ where C::Target: chain::Filter,
741733 }
742734 if update_res. is_err ( ) {
743735 ChannelMonitorUpdateStatus :: InProgress
744- } else if monitor_state. channel_perm_failed . load ( Ordering :: Acquire ) {
745- ChannelMonitorUpdateStatus :: InProgress
746736 } else {
747737 persist_res
748738 }
@@ -760,17 +750,6 @@ where C::Target: chain::Filter,
760750 {
761751 log_debug ! ( self . logger, "A Channel Monitor sync is still in progress, refusing to provide monitor events!" ) ;
762752 } else {
763- if monitor_state. channel_perm_failed . load ( Ordering :: Acquire ) {
764- // If a `UpdateOrigin::ChainSync` persistence failed with `PermanantFailure`,
765- // we don't really know if the latest `ChannelMonitor` state is on disk or not.
766- // We're supposed to hold monitor updates until the latest state is on disk to
767- // avoid duplicate events, but the user told us persistence is screw-y and may
768- // not complete. We can't hold events forever because we may learn some payment
769- // preimage, so instead we just log and hope the user complied with the
770- // `PermanentFailure` requirements of having at least the local-disk copy
771- // updated.
772- log_info ! ( self . logger, "A Channel Monitor sync returned PermanentFailure. Returning monitor events but duplicate events may appear after reload!" ) ;
773- }
774753 if is_pending_monitor_update {
775754 log_error ! ( self . logger, "A ChannelMonitor sync took longer than {} blocks to complete." , LATENCY_GRACE_PERIOD_BLOCKS ) ;
776755 log_error ! ( self . logger, " To avoid funds-loss, we are allowing monitor updates to be released." ) ;
0 commit comments