Skip to content

Commit 4666184

Browse files
committed
Add more logging during chanmon_consistency runs
1 parent 02cb99c commit 4666184

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

fuzz/src/chanmon_consistency.rs

+14-4
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,10 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
646646
had_events = true;
647647
match event {
648648
events::MessageSendEvent::UpdateHTLCs { node_id, updates: CommitmentUpdate { update_add_htlcs, update_fail_htlcs, update_fulfill_htlcs, update_fail_malformed_htlcs, update_fee, commitment_signed } } => {
649-
for dest in nodes.iter() {
649+
for (idx, dest) in nodes.iter().enumerate() {
650650
if dest.get_our_node_id() == node_id {
651651
for update_add in update_add_htlcs.iter() {
652+
out.locked_write(format!("Delivering update_add_htlc to node {}.\n", idx).as_bytes());
652653
if !$corrupt_forward {
653654
dest.handle_update_add_htlc(&nodes[$node].get_our_node_id(), update_add);
654655
} else {
@@ -663,15 +664,19 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
663664
}
664665
}
665666
for update_fulfill in update_fulfill_htlcs.iter() {
667+
out.locked_write(format!("Delivering update_fulfill_htlc to node {}.\n", idx).as_bytes());
666668
dest.handle_update_fulfill_htlc(&nodes[$node].get_our_node_id(), update_fulfill);
667669
}
668670
for update_fail in update_fail_htlcs.iter() {
671+
out.locked_write(format!("Delivering update_fail_htlc to node {}.\n", idx).as_bytes());
669672
dest.handle_update_fail_htlc(&nodes[$node].get_our_node_id(), update_fail);
670673
}
671674
for update_fail_malformed in update_fail_malformed_htlcs.iter() {
675+
out.locked_write(format!("Delivering update_fail_malformed_htlc to node {}.\n", idx).as_bytes());
672676
dest.handle_update_fail_malformed_htlc(&nodes[$node].get_our_node_id(), update_fail_malformed);
673677
}
674678
if let Some(msg) = update_fee {
679+
out.locked_write(format!("Delivering update_fee to node {}.\n", idx).as_bytes());
675680
dest.handle_update_fee(&nodes[$node].get_our_node_id(), &msg);
676681
}
677682
let processed_change = !update_add_htlcs.is_empty() || !update_fulfill_htlcs.is_empty() ||
@@ -688,21 +693,24 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
688693
} });
689694
break;
690695
}
696+
out.locked_write(format!("Delivering commitment_signed to node {}.\n", idx).as_bytes());
691697
dest.handle_commitment_signed(&nodes[$node].get_our_node_id(), &commitment_signed);
692698
break;
693699
}
694700
}
695701
},
696702
events::MessageSendEvent::SendRevokeAndACK { ref node_id, ref msg } => {
697-
for dest in nodes.iter() {
703+
for (idx, dest) in nodes.iter().enumerate() {
698704
if dest.get_our_node_id() == *node_id {
705+
out.locked_write(format!("Delivering revoke_and_ack to node {}.\n", idx).as_bytes());
699706
dest.handle_revoke_and_ack(&nodes[$node].get_our_node_id(), msg);
700707
}
701708
}
702709
},
703710
events::MessageSendEvent::SendChannelReestablish { ref node_id, ref msg } => {
704-
for dest in nodes.iter() {
711+
for (idx, dest) in nodes.iter().enumerate() {
705712
if dest.get_our_node_id() == *node_id {
713+
out.locked_write(format!("Delivering channel_reestablish to node {}.\n", idx).as_bytes());
706714
dest.handle_channel_reestablish(&nodes[$node].get_our_node_id(), msg);
707715
}
708716
}
@@ -834,7 +842,9 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
834842
} }
835843
}
836844

837-
match get_slice!(1)[0] {
845+
let v = get_slice!(1)[0];
846+
out.locked_write(format!("READ A BYTE! HANDLING INPUT {:x}...........\n", v).as_bytes());
847+
match v {
838848
// In general, we keep related message groups close together in binary form, allowing
839849
// bit-twiddling mutations to have similar effects. This is probably overkill, but no
840850
// harm in doing so.

0 commit comments

Comments
 (0)