2018-07-16 21:12:54 -07:00
|
|
|
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
|
|
|
|
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
|
|
|
|
|
|
|
|
extern crate lightning;
|
|
|
|
|
|
|
|
use lightning::ln::channelmonitor;
|
|
|
|
use lightning::util::reset_rng_state;
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn do_test(data: &[u8]) {
|
|
|
|
reset_rng_state();
|
|
|
|
if let Some(monitor) = channelmonitor::ChannelMonitor::deserialize(data) {
|
|
|
|
assert!(channelmonitor::ChannelMonitor::deserialize(&monitor.serialize_for_disk()[..]).unwrap() == monitor);
|
|
|
|
monitor.serialize_for_watchtower();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "afl")]
|
|
|
|
extern crate afl;
|
|
|
|
#[cfg(feature = "afl")]
|
|
|
|
fn main() {
|
|
|
|
afl::read_stdio_bytes(|data| {
|
|
|
|
do_test(&data);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "honggfuzz")]
|
|
|
|
#[macro_use] extern crate honggfuzz;
|
|
|
|
#[cfg(feature = "honggfuzz")]
|
|
|
|
fn main() {
|
|
|
|
loop {
|
|
|
|
fuzz!(|data| {
|
|
|
|
do_test(data);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-28 09:44:15 -07:00
|
|
|
extern crate hex;
|
2018-07-16 21:12:54 -07:00
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn duplicate_crash() {
|
2018-07-28 09:44:15 -07:00
|
|
|
super::do_test(&::hex::decode("00").unwrap());
|
2018-07-16 21:12:54 -07:00
|
|
|
}
|
|
|
|
}
|