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 {
545545 ///
546546 /// [`ChannelMonitor`]: channelmonitor::ChannelMonitor
547547 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 > >
548551}
549552impl TestPersister {
550553 pub fn new ( ) -> Self {
551554 Self {
552555 update_rets : Mutex :: new ( VecDeque :: new ( ) ) ,
553556 offchain_monitor_updates : Mutex :: new ( new_hash_map ( ) ) ,
557+ chain_sync_monitor_persistences : Mutex :: new ( VecDeque :: new ( ) )
554558 }
555559 }
556560
@@ -573,15 +577,18 @@ impl<Signer: sign::ecdsa::EcdsaChannelSigner> chainmonitor::Persist<Signer> for
573577 ret = update_ret;
574578 }
575579
576- if let Some ( update) = update {
580+ if let Some ( update) = update {
577581 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) ;
578584 }
579585 ret
580586 }
581587
582588 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.
584590 self . offchain_monitor_updates . lock ( ) . unwrap ( ) . remove ( & funding_txo) ;
591+ self . chain_sync_monitor_persistences . lock ( ) . unwrap ( ) . retain ( |x| x != & funding_txo) ;
585592 }
586593}
587594
You can’t perform that action at this time.
0 commit comments