@@ -371,6 +371,10 @@ 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+ /// The queued operations can be flushed with [`Self::flush`].
377+ deferred : bool ,
374378}
375379
376380impl <
@@ -397,7 +401,7 @@ where
397401 pub fn new_async_beta (
398402 chain_source : Option < C > , broadcaster : T , logger : L , feeest : F ,
399403 persister : MonitorUpdatingPersisterAsync < K , S , L , ES , SP , T , F > , _entropy_source : ES ,
400- _our_peerstorage_encryption_key : PeerStorageKey ,
404+ _our_peerstorage_encryption_key : PeerStorageKey , deferred : bool ,
401405 ) -> Self {
402406 let event_notifier = Arc :: new ( Notifier :: new ( ) ) ;
403407 Self {
@@ -414,6 +418,7 @@ where
414418 pending_send_only_events : Mutex :: new ( Vec :: new ( ) ) ,
415419 #[ cfg( peer_storage) ]
416420 our_peerstorage_encryption_key : _our_peerstorage_encryption_key,
421+ deferred,
417422 }
418423 }
419424}
@@ -603,7 +608,7 @@ where
603608 /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
604609 pub fn new (
605610 chain_source : Option < C > , broadcaster : T , logger : L , feeest : F , persister : P ,
606- _entropy_source : ES , _our_peerstorage_encryption_key : PeerStorageKey ,
611+ _entropy_source : ES , _our_peerstorage_encryption_key : PeerStorageKey , deferred : bool ,
607612 ) -> Self {
608613 Self {
609614 monitors : RwLock :: new ( new_hash_map ( ) ) ,
@@ -619,6 +624,7 @@ where
619624 pending_send_only_events : Mutex :: new ( Vec :: new ( ) ) ,
620625 #[ cfg( peer_storage) ]
621626 our_peerstorage_encryption_key : _our_peerstorage_encryption_key,
627+ deferred,
622628 }
623629 }
624630
@@ -1426,12 +1432,18 @@ where
14261432 fn watch_channel (
14271433 & self , channel_id : ChannelId , monitor : ChannelMonitor < ChannelSigner > ,
14281434 ) -> Result < ChannelMonitorUpdateStatus , ( ) > {
1435+ if self . deferred {
1436+ unimplemented ! ( ) ;
1437+ }
14291438 self . watch_channel_internal ( channel_id, monitor)
14301439 }
14311440
14321441 fn update_channel (
14331442 & self , channel_id : ChannelId , update : & ChannelMonitorUpdate ,
14341443 ) -> ChannelMonitorUpdateStatus {
1444+ if self . deferred {
1445+ unimplemented ! ( ) ;
1446+ }
14351447 self . update_channel_internal ( channel_id, update)
14361448 }
14371449
0 commit comments