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 @@ -545,12 +545,16 @@ pub struct TestPersister {
545
545
///
546
546
/// [`ChannelMonitor`]: channelmonitor::ChannelMonitor
547
547
pub offchain_monitor_updates : Mutex < HashMap < OutPoint , HashSet < u64 > > > ,
548
+ /// When we get an update_persisted_channel call with no ChannelMonitorUpdate, we insert the
549
+ /// monitor's funding outpoint here.
550
+ pub chain_sync_monitor_persistences : Mutex < VecDeque < OutPoint > >
548
551
}
549
552
impl TestPersister {
550
553
pub fn new ( ) -> Self {
551
554
Self {
552
555
update_rets : Mutex :: new ( VecDeque :: new ( ) ) ,
553
556
offchain_monitor_updates : Mutex :: new ( new_hash_map ( ) ) ,
557
+ chain_sync_monitor_persistences : Mutex :: new ( VecDeque :: new ( ) )
554
558
}
555
559
}
556
560
@@ -573,15 +577,18 @@ impl<Signer: sign::ecdsa::EcdsaChannelSigner> chainmonitor::Persist<Signer> for
573
577
ret = update_ret;
574
578
}
575
579
576
- if let Some ( update) = update {
580
+ if let Some ( update) = update {
577
581
self . offchain_monitor_updates . lock ( ) . unwrap ( ) . entry ( funding_txo) . or_insert ( new_hash_set ( ) ) . insert ( update. update_id ) ;
582
+ } else {
583
+ self . chain_sync_monitor_persistences . lock ( ) . unwrap ( ) . push_back ( funding_txo) ;
578
584
}
579
585
ret
580
586
}
581
587
582
588
fn archive_persisted_channel ( & self , funding_txo : OutPoint ) {
583
- // remove the channel from the offchain_monitor_updates map
589
+ // remove the channel from the offchain_monitor_updates and chain_sync_monitor_persistences.
584
590
self . offchain_monitor_updates . lock ( ) . unwrap ( ) . remove ( & funding_txo) ;
591
+ self . chain_sync_monitor_persistences . lock ( ) . unwrap ( ) . retain ( |x| x != & funding_txo) ;
585
592
}
586
593
}
587
594
You can’t perform that action at this time.
0 commit comments