@@ -179,12 +179,6 @@ struct MonitorHolder<ChannelSigner: WriteableEcdsaChannelSigner> {
179
179
/// the ChannelManager re-adding the same payment entry, before the same block is replayed,
180
180
/// resulting in a duplicate PaymentSent event.
181
181
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 ,
188
182
/// The last block height at which no [`UpdateOrigin::ChainSync`] monitor updates were present
189
183
/// in `pending_monitor_updates`.
190
184
/// 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,
485
479
// `MonitorEvent`s from the monitor back to the `ChannelManager` until they
486
480
// complete.
487
481
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
491
484
// Completed event.
492
485
return Ok ( ( ) ) ;
493
486
}
@@ -695,7 +688,6 @@ where C::Target: chain::Filter,
695
688
entry. insert ( MonitorHolder {
696
689
monitor,
697
690
pending_monitor_updates : Mutex :: new ( pending_monitor_updates) ,
698
- channel_perm_failed : AtomicBool :: new ( false ) ,
699
691
last_chain_persist_height : AtomicUsize :: new ( self . highest_chain_height . load ( Ordering :: Acquire ) ) ,
700
692
} ) ;
701
693
Ok ( persist_res)
@@ -741,8 +733,6 @@ where C::Target: chain::Filter,
741
733
}
742
734
if update_res. is_err ( ) {
743
735
ChannelMonitorUpdateStatus :: InProgress
744
- } else if monitor_state. channel_perm_failed . load ( Ordering :: Acquire ) {
745
- ChannelMonitorUpdateStatus :: InProgress
746
736
} else {
747
737
persist_res
748
738
}
@@ -760,17 +750,6 @@ where C::Target: chain::Filter,
760
750
{
761
751
log_debug ! ( self . logger, "A Channel Monitor sync is still in progress, refusing to provide monitor events!" ) ;
762
752
} 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
- }
774
753
if is_pending_monitor_update {
775
754
log_error ! ( self . logger, "A ChannelMonitor sync took longer than {} blocks to complete." , LATENCY_GRACE_PERIOD_BLOCKS ) ;
776
755
log_error ! ( self . logger, " To avoid funds-loss, we are allowing monitor updates to be released." ) ;
0 commit comments