@@ -373,6 +373,9 @@ pub struct ChainMonitor<
373373
374374 #[ cfg( peer_storage) ]
375375 our_peerstorage_encryption_key : PeerStorageKey ,
376+
377+ /// When `true`, [`chain::Watch`] operations are queued rather than executed immediately.
378+ deferred : bool ,
376379}
377380
378381impl <
@@ -399,7 +402,7 @@ where
399402 pub fn new_async_beta (
400403 chain_source : Option < C > , broadcaster : T , logger : L , feeest : F ,
401404 persister : MonitorUpdatingPersisterAsync < K , S , L , ES , SP , T , F > , _entropy_source : ES ,
402- _our_peerstorage_encryption_key : PeerStorageKey ,
405+ _our_peerstorage_encryption_key : PeerStorageKey , deferred : bool ,
403406 ) -> Self {
404407 let event_notifier = Arc :: new ( Notifier :: new ( ) ) ;
405408 Self {
@@ -416,6 +419,7 @@ where
416419 pending_send_only_events : Mutex :: new ( Vec :: new ( ) ) ,
417420 #[ cfg( peer_storage) ]
418421 our_peerstorage_encryption_key : _our_peerstorage_encryption_key,
422+ deferred,
419423 }
420424 }
421425}
@@ -605,7 +609,7 @@ where
605609 /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
606610 pub fn new (
607611 chain_source : Option < C > , broadcaster : T , logger : L , feeest : F , persister : P ,
608- _entropy_source : ES , _our_peerstorage_encryption_key : PeerStorageKey ,
612+ _entropy_source : ES , _our_peerstorage_encryption_key : PeerStorageKey , deferred : bool ,
609613 ) -> Self {
610614 Self {
611615 monitors : RwLock :: new ( new_hash_map ( ) ) ,
@@ -621,6 +625,7 @@ where
621625 pending_send_only_events : Mutex :: new ( Vec :: new ( ) ) ,
622626 #[ cfg( peer_storage) ]
623627 our_peerstorage_encryption_key : _our_peerstorage_encryption_key,
628+ deferred,
624629 }
625630 }
626631
@@ -1428,13 +1433,21 @@ where
14281433 fn watch_channel (
14291434 & self , channel_id : ChannelId , monitor : ChannelMonitor < ChannelSigner > ,
14301435 ) -> Result < ChannelMonitorUpdateStatus , ( ) > {
1431- self . watch_channel_internal ( channel_id, monitor)
1436+ if !self . deferred {
1437+ return self . watch_channel_internal ( channel_id, monitor) ;
1438+ }
1439+
1440+ unimplemented ! ( ) ;
14321441 }
14331442
14341443 fn update_channel (
14351444 & self , channel_id : ChannelId , update : & ChannelMonitorUpdate ,
14361445 ) -> ChannelMonitorUpdateStatus {
1437- self . update_channel_internal ( channel_id, update)
1446+ if !self . deferred {
1447+ return self . update_channel_internal ( channel_id, update) ;
1448+ }
1449+
1450+ unimplemented ! ( ) ;
14381451 }
14391452
14401453 fn release_pending_monitor_events (
0 commit comments