]> git.bitcoin.ninja Git - rust-lightning/commitdiff
`rustfmt`: `fuzz/src/chanmon_deser.rs`
authorElias Rohrer <dev@tnull.de>
Thu, 6 Jun 2024 11:06:59 +0000 (13:06 +0200)
committerElias Rohrer <dev@tnull.de>
Fri, 7 Jun 2024 18:37:09 +0000 (20:37 +0200)
fuzz/src/chanmon_deser.rs
rustfmt_excluded_files

index 8d425357c96844b2b9766de612879750f4dceddc..b9c0121377245cb73b62a23ca24cea4f97c729d8 100644 (file)
@@ -4,8 +4,8 @@
 use bitcoin::hash_types::BlockHash;
 
 use lightning::chain::channelmonitor;
+use lightning::util::ser::{ReadableArgs, Writeable, Writer};
 use lightning::util::test_channel_signer::TestChannelSigner;
-use lightning::util::ser::{ReadableArgs, Writer, Writeable};
 use lightning::util::test_utils::OnlyReadsKeysInterface;
 
 use crate::utils::test_logger;
@@ -22,10 +22,19 @@ impl Writer for VecWriter {
 
 #[inline]
 pub fn do_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
-       if let Ok((latest_block_hash, monitor)) = <(BlockHash, channelmonitor::ChannelMonitor<TestChannelSigner>)>::read(&mut Cursor::new(data), (&OnlyReadsKeysInterface {}, &OnlyReadsKeysInterface {})) {
+       if let Ok((latest_block_hash, monitor)) =
+               <(BlockHash, channelmonitor::ChannelMonitor<TestChannelSigner>)>::read(
+                       &mut Cursor::new(data),
+                       (&OnlyReadsKeysInterface {}, &OnlyReadsKeysInterface {}),
+               ) {
                let mut w = VecWriter(Vec::new());
                monitor.write(&mut w).unwrap();
-               let deserialized_copy = <(BlockHash, channelmonitor::ChannelMonitor<TestChannelSigner>)>::read(&mut Cursor::new(&w.0), (&OnlyReadsKeysInterface {}, &OnlyReadsKeysInterface {})).unwrap();
+               let deserialized_copy =
+                       <(BlockHash, channelmonitor::ChannelMonitor<TestChannelSigner>)>::read(
+                               &mut Cursor::new(&w.0),
+                               (&OnlyReadsKeysInterface {}, &OnlyReadsKeysInterface {}),
+                       )
+                       .unwrap();
                assert!(latest_block_hash == deserialized_copy.0);
                assert!(monitor == deserialized_copy.1);
        }
@@ -37,5 +46,5 @@ pub fn chanmon_deser_test<Out: test_logger::Output>(data: &[u8], out: Out) {
 
 #[no_mangle]
 pub extern "C" fn chanmon_deser_run(data: *const u8, datalen: usize) {
-       do_test(unsafe { std::slice::from_raw_parts(data, datalen) }, test_logger::DevNull{});
+       do_test(unsafe { std::slice::from_raw_parts(data, datalen) }, test_logger::DevNull {});
 }
index 177a22b779453f14ca8b5d1295bd27b365481424..89dd4ab41d71ff5520639d8d6638cba9ccd159ac 100644 (file)
@@ -1,6 +1,5 @@
 ./bench/benches/bench.rs
 ./fuzz/src/chanmon_consistency.rs
-./fuzz/src/chanmon_deser.rs
 ./fuzz/src/fromstr_to_netaddress.rs
 ./fuzz/src/full_stack.rs
 ./fuzz/src/indexedmap.rs