]> git.bitcoin.ninja Git - rust-lightning/commitdiff
TESTING
authorMatt Corallo <git@bluematt.me>
Thu, 7 Mar 2019 16:33:19 +0000 (11:33 -0500)
committerMatt Corallo <git@bluematt.me>
Mon, 3 Feb 2020 02:38:54 +0000 (21:38 -0500)
fuzz/src/chanmon_consistency.rs
fuzz/src/utils/test_logger.rs

index 95def807bd32957ade14ab559bbfaa45ee2794b1..c0b897e21a3ab65d97e0df0d01a3587f8fcb3f67 100644 (file)
@@ -501,7 +501,28 @@ pub fn do_test(data: &[u8]) {
                                        bc_events.clear();
                                        new_events
                                } else { Vec::new() };
-                               for event in events.iter().chain(nodes[$node].get_and_clear_pending_msg_events().iter()) {
+                               let ev = nodes[$node].get_and_clear_pending_msg_events();
+                               for event in events.iter().chain(ev.iter()) {
+                                       match event {
+                                               events::MessageSendEvent::UpdateHTLCs { updates: CommitmentUpdate { ref update_add_htlcs, ref update_fail_htlcs, ref update_fulfill_htlcs, ref update_fail_malformed_htlcs, .. }, .. } => {
+                                                       println!("UPDATEHTLCs {} {} {} {}", update_add_htlcs.len(), update_fail_htlcs.len(), update_fulfill_htlcs.len(), update_fail_malformed_htlcs.len());
+                                               },
+                                               events::MessageSendEvent::SendRevokeAndACK { .. } => {
+                                                       println!("RAA");
+                                               },
+                                               events::MessageSendEvent::SendChannelReestablish { .. } => {
+                                                       println!("Chan REE");
+                                               },
+                                               events::MessageSendEvent::SendFundingLocked { .. } => {
+                                                       println!("FL");
+                                               },
+                                               events::MessageSendEvent::PaymentFailureNetworkUpdate { .. } => {
+                                                       println!("Fail net update");
+                                               },
+                                               _ => panic!("Unhandled message event"),
+                                       }
+                               }
+                               for event in events.iter().chain(ev.iter()) {
                                        match event {
                                                events::MessageSendEvent::UpdateHTLCs { ref node_id, updates: CommitmentUpdate { ref update_add_htlcs, ref update_fail_htlcs, ref update_fulfill_htlcs, ref update_fail_malformed_htlcs, ref update_fee, ref commitment_signed } } => {
                                                        for dest in nodes.iter() {
@@ -663,7 +684,9 @@ pub fn do_test(data: &[u8]) {
                        } }
                }
 
-               match get_slice!(1)[0] {
+        let a = get_slice!(1)[0];
+        println!("PROCESSING {:x}", a);
+               match a {
                        0x00 => *monitor_a.update_ret.lock().unwrap() = Err(ChannelMonitorUpdateErr::TemporaryFailure),
                        0x01 => *monitor_b.update_ret.lock().unwrap() = Err(ChannelMonitorUpdateErr::TemporaryFailure),
                        0x02 => *monitor_c.update_ret.lock().unwrap() = Err(ChannelMonitorUpdateErr::TemporaryFailure),
index 097d001dbb25f80e0049a6c1526c379365a0f49f..d92a749e946d770a272c655a2cf255e6ca359c7c 100644 (file)
@@ -16,7 +16,7 @@ impl TestLogger {
 impl Logger for TestLogger {
        fn log(&self, record: &Record) {
                #[cfg(test)]
-               println!("{:<5} {} [{} : {}, {}] {}", record.level.to_string(), self.id, record.module_path, record.file, record.line, record.args);
+               println!("{:<5} {} [ : {}, {}] {}", record.level.to_string(), self.id, record.module_path, record.line, record.args);
                #[cfg(not(test))]
                let _ = format!("{}", record.args);
        }