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 {
531531 ///
532532 /// [`ChannelMonitor`]: channelmonitor::ChannelMonitor
533533 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 > >
534537}
535538impl TestPersister {
536539 pub fn new ( ) -> Self {
537540 Self {
538541 update_rets : Mutex :: new ( VecDeque :: new ( ) ) ,
539542 offchain_monitor_updates : Mutex :: new ( new_hash_map ( ) ) ,
543+ chain_sync_monitor_persistences : Mutex :: new ( VecDeque :: new ( ) )
540544 }
541545 }
542546
@@ -559,15 +563,18 @@ impl<Signer: sign::ecdsa::EcdsaChannelSigner> chainmonitor::Persist<Signer> for
559563 ret = update_ret;
560564 }
561565
562- if let Some ( update) = update {
566+ if let Some ( update) = update {
563567 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) ;
564570 }
565571 ret
566572 }
567573
568574 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.
570576 self . offchain_monitor_updates . lock ( ) . unwrap ( ) . remove ( & funding_txo) ;
577+ self . chain_sync_monitor_persistences . lock ( ) . unwrap ( ) . retain ( |x| x != & funding_txo) ;
571578 }
572579}
573580
You can’t perform that action at this time.
0 commit comments