X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;fp=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=2fa7cef389e51326388d81ecd855d4fe28726b25;hb=ab7a0a54318cdd55bedc3a02604af200b16e2e2c;hp=a38aea2d4374a4a118709ee86d4c51e9580d006e;hpb=3e26bd7a1dfb780d4534304f7e48f66a7ae1a9ea;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index a38aea2d..2fa7cef3 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -66,13 +66,14 @@ impl<'a> channelmonitor::ManyChannelMonitor for TestChanne // to a watchtower and disk... let mut w = TestVecWriter(Vec::new()); monitor.write_for_disk(&mut w).unwrap(); - assert!(<(Sha256dHash, channelmonitor::ChannelMonitor)>::read( - &mut ::std::io::Cursor::new(&w.0), Arc::new(TestLogger::new())).unwrap().1 == monitor); + let new_monitor = <(Sha256dHash, channelmonitor::ChannelMonitor)>::read( + &mut ::std::io::Cursor::new(&w.0), Arc::new(TestLogger::new())).unwrap().1; + assert!(new_monitor == monitor); w.0.clear(); monitor.write_for_watchtower(&mut w).unwrap(); // This at least shouldn't crash... - self.added_monitors.lock().unwrap().push((funding_txo, monitor.clone())); self.latest_monitor_update_id.lock().unwrap().insert(funding_txo.to_channel_id(), (funding_txo, monitor.get_latest_update_id())); - assert!(self.simple_monitor.add_monitor(funding_txo, monitor).is_ok()); + 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() } @@ -91,11 +92,12 @@ impl<'a> channelmonitor::ManyChannelMonitor for TestChanne let monitor = monitors.get(&funding_txo).unwrap(); w.0.clear(); monitor.write_for_disk(&mut w).unwrap(); - assert!(<(Sha256dHash, channelmonitor::ChannelMonitor)>::read( - &mut ::std::io::Cursor::new(&w.0), Arc::new(TestLogger::new())).unwrap().1 == *monitor); + let new_monitor = <(Sha256dHash, channelmonitor::ChannelMonitor)>::read( + &mut ::std::io::Cursor::new(&w.0), Arc::new(TestLogger::new())).unwrap().1; + assert!(new_monitor == *monitor); w.0.clear(); monitor.write_for_watchtower(&mut w).unwrap(); // This at least shouldn't crash... - self.added_monitors.lock().unwrap().push((funding_txo, monitor.clone())); + self.added_monitors.lock().unwrap().push((funding_txo, new_monitor)); self.update_ret.lock().unwrap().clone() }