X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=fuzz%2Fsrc%2Fchanmon_deser.rs;h=8d425357c96844b2b9766de612879750f4dceddc;hb=22a0bfc073f7d7b5be39abf16b530d31ab81cd3c;hp=3f4ff5ad0a131789cf12fc00ef0c1f560d067f73;hpb=87126b391b895098484a86dc484a381b825e9a31;p=rust-lightning diff --git a/fuzz/src/chanmon_deser.rs b/fuzz/src/chanmon_deser.rs index 3f4ff5ad..8d425357 100644 --- a/fuzz/src/chanmon_deser.rs +++ b/fuzz/src/chanmon_deser.rs @@ -3,11 +3,12 @@ use bitcoin::hash_types::BlockHash; -use lightning::util::enforcing_trait_impls::EnforcingChannelKeys; -use lightning::ln::channelmonitor; -use lightning::util::ser::{Readable, Writer}; +use lightning::chain::channelmonitor; +use lightning::util::test_channel_signer::TestChannelSigner; +use lightning::util::ser::{ReadableArgs, Writer, Writeable}; +use lightning::util::test_utils::OnlyReadsKeysInterface; -use utils::test_logger; +use crate::utils::test_logger; use std::io::Cursor; @@ -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 {}, &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 {}, &OnlyReadsKeysInterface {})).unwrap(); assert!(latest_block_hash == deserialized_copy.0); assert!(monitor == deserialized_copy.1); }