- if let Some(monitor) = channelmonitor::ChannelMonitor::deserialize(data) {
- assert!(channelmonitor::ChannelMonitor::deserialize(&monitor.serialize_for_disk()[..]).unwrap() == monitor);
- monitor.serialize_for_watchtower();
+ let logger = Arc::new(test_logger::TestLogger::new("".to_owned()));
+ if let Ok((latest_block_hash, monitor)) = <(Sha256dHash, channelmonitor::ChannelMonitor)>::read(&mut Cursor::new(data), logger.clone()) {
+ let mut w = VecWriter(Vec::new());
+ monitor.write_for_disk(&mut w).unwrap();
+ let deserialized_copy = <(Sha256dHash, channelmonitor::ChannelMonitor)>::read(&mut Cursor::new(&w.0), logger.clone()).unwrap();
+ assert!(latest_block_hash == deserialized_copy.0);
+ assert!(monitor == deserialized_copy.1);
+ w.0.clear();
+ monitor.write_for_watchtower(&mut w).unwrap();