+ let new_monitor = <(Sha256dHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(
+ &mut ::std::io::Cursor::new(&w.0), Arc::new(TestLogger::new())).unwrap().1;
+ assert!(new_monitor == monitor);
+ self.latest_monitor_update_id.lock().unwrap().insert(funding_txo.to_channel_id(), (funding_txo, monitor.get_latest_update_id()));
+ self.added_monitors.lock().unwrap().push((funding_txo, monitor));
+ assert!(self.simple_monitor.add_monitor(funding_txo, new_monitor).is_ok());
+ self.update_ret.lock().unwrap().clone()
+ }
+
+ fn update_monitor(&self, funding_txo: OutPoint, update: channelmonitor::ChannelMonitorUpdate) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> {
+ // Every monitor update should survive roundtrip
+ let mut w = TestVecWriter(Vec::new());
+ update.write(&mut w).unwrap();
+ assert!(channelmonitor::ChannelMonitorUpdate::read(
+ &mut ::std::io::Cursor::new(&w.0)).unwrap() == update);
+
+ self.latest_monitor_update_id.lock().unwrap().insert(funding_txo.to_channel_id(), (funding_txo, update.update_id));
+ assert!(self.simple_monitor.update_monitor(funding_txo, update).is_ok());
+ // At every point where we get a monitor update, we should be able to send a useful monitor
+ // to a watchtower and disk...
+ let monitors = self.simple_monitor.monitors.lock().unwrap();
+ let monitor = monitors.get(&funding_txo).unwrap();