@@ -86,6 +86,8 @@ pub enum BuildError {
86
86
InvalidSeedFile ,
87
87
/// The current system time is invalid, clocks might have gone backwards.
88
88
InvalidSystemTime ,
89
+ /// The a read channel monitor is invalid.
90
+ InvalidChannelMonitor ,
89
91
/// We failed to read data from the [`KVStore`].
90
92
ReadFailed ,
91
93
/// We failed to write data to the [`KVStore`].
@@ -108,6 +110,9 @@ impl fmt::Display for BuildError {
108
110
Self :: InvalidSystemTime => {
109
111
write ! ( f, "System time is invalid. Clocks might have gone back in time." )
110
112
}
113
+ Self :: InvalidChannelMonitor => {
114
+ write ! ( f, "Failed to watch a deserialzed ChannelMonitor" )
115
+ }
111
116
Self :: ReadFailed => write ! ( f, "Failed to read from store." ) ,
112
117
Self :: WriteFailed => write ! ( f, "Failed to write to store." ) ,
113
118
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>(
608
613
// Give ChannelMonitors to ChainMonitor
609
614
for ( _blockhash, channel_monitor) in channel_monitors. into_iter ( ) {
610
615
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
+ } ) ?;
612
620
}
613
621
614
622
// Initialize the PeerManager
0 commit comments