File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -531,12 +531,16 @@ pub struct TestPersister {
531
531
///
532
532
/// [`ChannelMonitor`]: channelmonitor::ChannelMonitor
533
533
pub offchain_monitor_updates : Mutex < HashMap < OutPoint , HashSet < u64 > > > ,
534
+ /// When we get an update_persisted_channel call with no ChannelMonitorUpdate, we insert the
535
+ /// monitor's funding outpoint here.
536
+ pub chain_sync_monitor_persistences : Mutex < VecDeque < OutPoint > >
534
537
}
535
538
impl TestPersister {
536
539
pub fn new ( ) -> Self {
537
540
Self {
538
541
update_rets : Mutex :: new ( VecDeque :: new ( ) ) ,
539
542
offchain_monitor_updates : Mutex :: new ( new_hash_map ( ) ) ,
543
+ chain_sync_monitor_persistences : Mutex :: new ( VecDeque :: new ( ) )
540
544
}
541
545
}
542
546
@@ -559,15 +563,18 @@ impl<Signer: sign::ecdsa::EcdsaChannelSigner> chainmonitor::Persist<Signer> for
559
563
ret = update_ret;
560
564
}
561
565
562
- if let Some ( update) = update {
566
+ if let Some ( update) = update {
563
567
self . offchain_monitor_updates . lock ( ) . unwrap ( ) . entry ( funding_txo) . or_insert ( new_hash_set ( ) ) . insert ( update. update_id ) ;
568
+ } else {
569
+ self . chain_sync_monitor_persistences . lock ( ) . unwrap ( ) . push_back ( funding_txo) ;
564
570
}
565
571
ret
566
572
}
567
573
568
574
fn archive_persisted_channel ( & self , funding_txo : OutPoint ) {
569
- // remove the channel from the offchain_monitor_updates map
575
+ // remove the channel from the offchain_monitor_updates and chain_sync_monitor_persistences.
570
576
self . offchain_monitor_updates . lock ( ) . unwrap ( ) . remove ( & funding_txo) ;
577
+ self . chain_sync_monitor_persistences . lock ( ) . unwrap ( ) . retain ( |x| x != & funding_txo) ;
571
578
}
572
579
}
573
580
You can’t perform that action at this time.
0 commit comments