@@ -371,6 +371,9 @@ pub struct ChainMonitor<
371371
372372 #[ cfg( peer_storage) ]
373373 our_peerstorage_encryption_key : PeerStorageKey ,
374+
375+ /// When `true`, [`chain::Watch`] operations are queued rather than executed immediately.
376+ deferred : bool ,
374377}
375378
376379impl <
@@ -397,7 +400,7 @@ where
397400 pub fn new_async_beta (
398401 chain_source : Option < C > , broadcaster : T , logger : L , feeest : F ,
399402 persister : MonitorUpdatingPersisterAsync < K , S , L , ES , SP , T , F > , _entropy_source : ES ,
400- _our_peerstorage_encryption_key : PeerStorageKey ,
403+ _our_peerstorage_encryption_key : PeerStorageKey , deferred : bool ,
401404 ) -> Self {
402405 let event_notifier = Arc :: new ( Notifier :: new ( ) ) ;
403406 Self {
@@ -414,6 +417,7 @@ where
414417 pending_send_only_events : Mutex :: new ( Vec :: new ( ) ) ,
415418 #[ cfg( peer_storage) ]
416419 our_peerstorage_encryption_key : _our_peerstorage_encryption_key,
420+ deferred,
417421 }
418422 }
419423}
@@ -603,7 +607,7 @@ where
603607 /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
604608 pub fn new (
605609 chain_source : Option < C > , broadcaster : T , logger : L , feeest : F , persister : P ,
606- _entropy_source : ES , _our_peerstorage_encryption_key : PeerStorageKey ,
610+ _entropy_source : ES , _our_peerstorage_encryption_key : PeerStorageKey , deferred : bool ,
607611 ) -> Self {
608612 Self {
609613 monitors : RwLock :: new ( new_hash_map ( ) ) ,
@@ -619,6 +623,7 @@ where
619623 pending_send_only_events : Mutex :: new ( Vec :: new ( ) ) ,
620624 #[ cfg( peer_storage) ]
621625 our_peerstorage_encryption_key : _our_peerstorage_encryption_key,
626+ deferred,
622627 }
623628 }
624629
@@ -1426,13 +1431,21 @@ where
14261431 fn watch_channel (
14271432 & self , channel_id : ChannelId , monitor : ChannelMonitor < ChannelSigner > ,
14281433 ) -> Result < ChannelMonitorUpdateStatus , ( ) > {
1429- self . watch_channel_internal ( channel_id, monitor)
1434+ if !self . deferred {
1435+ return self . watch_channel_internal ( channel_id, monitor) ;
1436+ }
1437+
1438+ unimplemented ! ( ) ;
14301439 }
14311440
14321441 fn update_channel (
14331442 & self , channel_id : ChannelId , update : & ChannelMonitorUpdate ,
14341443 ) -> ChannelMonitorUpdateStatus {
1435- self . update_channel_internal ( channel_id, update)
1444+ if !self . deferred {
1445+ return self . update_channel_internal ( channel_id, update) ;
1446+ }
1447+
1448+ unimplemented ! ( ) ;
14361449 }
14371450
14381451 fn release_pending_monitor_events (
0 commit comments