@@ -86,6 +86,8 @@ pub enum BuildError {
8686 InvalidSeedFile ,
8787 /// The current system time is invalid, clocks might have gone backwards.
8888 InvalidSystemTime ,
89+ /// The a read channel monitor is invalid.
90+ InvalidChannelMonitor ,
8991 /// We failed to read data from the [`KVStore`].
9092 ReadFailed ,
9193 /// We failed to write data to the [`KVStore`].
@@ -108,6 +110,9 @@ impl fmt::Display for BuildError {
108110 Self :: InvalidSystemTime => {
109111 write ! ( f, "System time is invalid. Clocks might have gone back in time." )
110112 }
113+ Self :: InvalidChannelMonitor => {
114+ write ! ( f, "Failed to watch a deserialzed ChannelMonitor" )
115+ }
111116 Self :: ReadFailed => write ! ( f, "Failed to read from store." ) ,
112117 Self :: WriteFailed => write ! ( f, "Failed to write to store." ) ,
113118 Self :: StoragePathAccessFailed => write ! ( f, "Failed to access the given storage path." ) ,
@@ -608,7 +613,10 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
608613 // Give ChannelMonitors to ChainMonitor
609614 for ( _blockhash, channel_monitor) in channel_monitors. into_iter ( ) {
610615 let funding_outpoint = channel_monitor. get_funding_txo ( ) . 0 ;
611- chain_monitor. watch_channel ( funding_outpoint, channel_monitor) ;
616+ chain_monitor. watch_channel ( funding_outpoint, channel_monitor) . map_err ( |e| {
617+ log_error ! ( logger, "Failed to watch channel monitor: {:?}" , e) ;
618+ BuildError :: InvalidChannelMonitor
619+ } ) ?;
612620 }
613621
614622 // Initialize the PeerManager
0 commit comments