X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=fuzz%2Fsrc%2Fchanmon_deser.rs;h=c31930342f43101e2b4e4bbac717939e3047a677;hb=e15a18a503a64625693ce20cabee00b20c9f3874;hp=5a76340ff309447c9cbae3baa0b112353b027210;hpb=819a8653afc1f429685b2075f7c79d6a323506fb;p=rust-lightning diff --git a/fuzz/src/chanmon_deser.rs b/fuzz/src/chanmon_deser.rs index 5a76340f..c3193034 100644 --- a/fuzz/src/chanmon_deser.rs +++ b/fuzz/src/chanmon_deser.rs @@ -4,8 +4,9 @@ use bitcoin::hash_types::BlockHash; use lightning::chain::channelmonitor; -use lightning::util::enforcing_trait_impls::EnforcingChannelKeys; -use lightning::util::ser::{Readable, Writer}; +use lightning::util::enforcing_trait_impls::EnforcingSigner; +use lightning::util::ser::{ReadableArgs, Writer, Writeable}; +use lightning::util::test_utils::OnlyReadsKeysInterface; use utils::test_logger; @@ -17,17 +18,14 @@ impl Writer for VecWriter { self.0.extend_from_slice(buf); Ok(()) } - fn size_hint(&mut self, size: usize) { - self.0.reserve_exact(size); - } } #[inline] pub fn do_test(data: &[u8], _out: Out) { - if let Ok((latest_block_hash, monitor)) = <(BlockHash, channelmonitor::ChannelMonitor)>::read(&mut Cursor::new(data)) { + if let Ok((latest_block_hash, monitor)) = <(BlockHash, channelmonitor::ChannelMonitor)>::read(&mut Cursor::new(data), &OnlyReadsKeysInterface {}) { let mut w = VecWriter(Vec::new()); - monitor.write_for_disk(&mut w).unwrap(); - let deserialized_copy = <(BlockHash, channelmonitor::ChannelMonitor)>::read(&mut Cursor::new(&w.0)).unwrap(); + monitor.write(&mut w).unwrap(); + let deserialized_copy = <(BlockHash, channelmonitor::ChannelMonitor)>::read(&mut Cursor::new(&w.0), &OnlyReadsKeysInterface {}).unwrap(); assert!(latest_block_hash == deserialized_copy.0); assert!(monitor == deserialized_copy.1); }