Revert "Merge pull request #819 from TheBlueMatt/2021-03-810-rebased"
[rust-lightning] / fuzz / src / chanmon_deser.rs
index abff1319a9bccd4fabdfe68ec28fdc8279c1312c..933930cf6d163148cb28832fde7cbcf47133b90b 100644 (file)
@@ -1,16 +1,16 @@
 // 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.
 
-use bitcoin_hashes::sha256d::Hash as Sha256dHash;
+use bitcoin::hash_types::BlockHash;
 
-use lightning::util::enforcing_trait_impls::EnforcingChannelKeys;
-use lightning::ln::channelmonitor;
-use lightning::util::ser::{ReadableArgs, Writer};
+use lightning::chain::channelmonitor;
+use lightning::util::enforcing_trait_impls::EnforcingSigner;
+use lightning::util::ser::{ReadableArgs, Writer, Writeable};
+use lightning::util::test_utils::OnlyReadsKeysInterface;
 
 use utils::test_logger;
 
 use std::io::Cursor;
-use std::sync::Arc;
 
 struct VecWriter(Vec<u8>);
 impl Writer for VecWriter {
@@ -24,12 +24,11 @@ impl Writer for VecWriter {
 }
 
 #[inline]
-pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
-       let logger = Arc::new(test_logger::TestLogger::new("".to_owned(), out));
-       if let Ok((latest_block_hash, monitor)) = <(Sha256dHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(data), logger.clone()) {
+pub fn do_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
+       if let Ok((latest_block_hash, monitor)) = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingSigner>)>::read(&mut Cursor::new(data), &OnlyReadsKeysInterface {}) {
                let mut w = VecWriter(Vec::new());
-               monitor.write_for_disk(&mut w).unwrap();
-               let deserialized_copy = <(Sha256dHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(&mut Cursor::new(&w.0), logger.clone()).unwrap();
+               monitor.write(&mut w).unwrap();
+               let deserialized_copy = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingSigner>)>::read(&mut Cursor::new(&w.0), &OnlyReadsKeysInterface {}).unwrap();
                assert!(latest_block_hash == deserialized_copy.0);
                assert!(monitor == deserialized_copy.1);
        }