X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=fuzz%2Fsrc%2Fchanmon_deser.rs;h=8d425357c96844b2b9766de612879750f4dceddc;hb=c0bf030ad29a7df4edc5337f50723fe99f88940d;hp=e7dbf3ed8d6a588aef5e7529d7295999018d01ca;hpb=793de5fe6944bb6ab414934e53a7ae80bb5a9a31;p=rust-lightning diff --git a/fuzz/src/chanmon_deser.rs b/fuzz/src/chanmon_deser.rs index e7dbf3ed..8d425357 100644 --- a/fuzz/src/chanmon_deser.rs +++ b/fuzz/src/chanmon_deser.rs @@ -4,11 +4,11 @@ use bitcoin::hash_types::BlockHash; use lightning::chain::channelmonitor; -use lightning::util::enforcing_trait_impls::EnforcingSigner; +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; @@ -18,20 +18,15 @@ 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((Some(latest_block_hash), monitor)) = <(Option, channelmonitor::ChannelMonitor)>::read(&mut Cursor::new(data), &OnlyReadsKeysInterface {}) { + 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(&mut w).unwrap(); - let deserialized_copy = <(Option, channelmonitor::ChannelMonitor)>::read(&mut Cursor::new(&w.0), &OnlyReadsKeysInterface {}).unwrap(); - if let Some(deserialized) = deserialized_copy.0 { - assert!(latest_block_hash == deserialized); - } + 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); } }