Utilize Writer size hinting in message fuzz targets and check them
[rust-lightning] / fuzz / fuzz_targets / msg_targets / msg_channel_reestablish_target.rs
index 09ad367e258136eb17021df623f7437335cde356..debd89466cdb5d5d05a6c676b39e2f391e34b0bd 100644 (file)
@@ -6,9 +6,8 @@ extern crate lightning;
 use lightning::ln::msgs;
 use lightning::util::reset_rng_state;
 
-use lightning::ln::msgs::{MsgEncodable, MsgDecodable};
-
 mod utils;
+use utils::VecWriter;
 
 #[inline]
 pub fn do_test(data: &[u8]) {
@@ -17,11 +16,11 @@ pub fn do_test(data: &[u8]) {
 }
 
 #[cfg(feature = "afl")]
-extern crate afl;
+#[macro_use] extern crate afl;
 #[cfg(feature = "afl")]
 fn main() {
-       afl::read_stdio_bytes(|data| {
-               do_test(&data);
+       fuzz!(|data| {
+               do_test(data);
        });
 }