@@ -639,19 +639,22 @@ where C::Target: chain::Filter,
639
639
/// Depending on the implementation of [`Persist::archive_persisted_channel`] the monitor
640
640
/// data could be moved to an archive location or removed entirely.
641
641
pub fn archive_fully_resolved_channel_monitors ( & self ) {
642
- let mut have_monitors_to_persist_or_prune = false ;
643
- for ( _ , monitor_holder) in self . monitors . read ( ) . unwrap ( ) . iter ( ) {
642
+ let mut have_monitors_to_prune = false ;
643
+ for ( funding_txo , monitor_holder) in self . monitors . read ( ) . unwrap ( ) . iter ( ) {
644
644
let logger = WithChannelMonitor :: from ( & self . logger , & monitor_holder. monitor , None ) ;
645
- let ( is_fully_resolved, needs_persistence) = monitor_holder. monitor . process_claim_resolution_status ( & logger) ;
646
- if is_fully_resolved || needs_persistence {
647
- have_monitors_to_persist_or_prune = true ;
645
+ let ( is_fully_resolved, needs_persistence) = monitor_holder. monitor . check_and_update_full_resolution_status ( & logger) ;
646
+ if is_fully_resolved {
647
+ have_monitors_to_prune = true ;
648
+ }
649
+ if needs_persistence {
650
+ self . persister . update_persisted_channel ( * funding_txo, None , & monitor_holder. monitor ) ;
648
651
}
649
652
}
650
- if have_monitors_to_persist_or_prune {
653
+ if have_monitors_to_prune {
651
654
let mut monitors = self . monitors . write ( ) . unwrap ( ) ;
652
655
monitors. retain ( |funding_txo, monitor_holder| {
653
656
let logger = WithChannelMonitor :: from ( & self . logger , & monitor_holder. monitor , None ) ;
654
- let ( is_fully_resolved, needs_persistence ) = monitor_holder. monitor . process_claim_resolution_status ( & logger) ;
657
+ let ( is_fully_resolved, _ ) = monitor_holder. monitor . check_and_update_full_resolution_status ( & logger) ;
655
658
if is_fully_resolved {
656
659
log_info ! ( logger,
657
660
"Archiving fully resolved ChannelMonitor for funding txo {}" ,
@@ -660,9 +663,6 @@ where C::Target: chain::Filter,
660
663
self . persister . archive_persisted_channel ( * funding_txo) ;
661
664
false
662
665
} else {
663
- if needs_persistence {
664
- self . persister . update_persisted_channel ( * funding_txo, None , & monitor_holder. monitor ) ;
665
- }
666
666
true
667
667
}
668
668
} ) ;
0 commit comments