Skip to content

Commit 32e5903

Browse files
committed
Restrict ChannelManager persist in fuzzing to when we're told to
In the `chanmon_consistency` fuzz, we currently "persist" the `ChannelManager` on each loop iteration. With the new logic in the past few commits to reduce the frequency of `ChannelManager` persistences, this behavior now leaves a gap in our test coverage - missing persistence notifications. In order to cath (common-case) persistence misses, we update the `chanmon_consistency` fuzzer to no longer persist the `ChannelManager` unless the waker was woken and signaled to persist, possibly reloading with a previous `ChannelManager` if we were not signaled.
1 parent 5c3fa55 commit 32e5903

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,12 +1296,18 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out) {
12961296
_ => test_return!(),
12971297
}
12981298

1299-
node_a_ser.0.clear();
1300-
nodes[0].write(&mut node_a_ser).unwrap();
1301-
node_b_ser.0.clear();
1302-
nodes[1].write(&mut node_b_ser).unwrap();
1303-
node_c_ser.0.clear();
1304-
nodes[2].write(&mut node_c_ser).unwrap();
1299+
if nodes[0].get_and_clear_needs_persistence() == true {
1300+
node_a_ser.0.clear();
1301+
nodes[0].write(&mut node_a_ser).unwrap();
1302+
}
1303+
if nodes[1].get_and_clear_needs_persistence() == true {
1304+
node_b_ser.0.clear();
1305+
nodes[1].write(&mut node_b_ser).unwrap();
1306+
}
1307+
if nodes[2].get_and_clear_needs_persistence() == true {
1308+
node_c_ser.0.clear();
1309+
nodes[2].write(&mut node_c_ser).unwrap();
1310+
}
13051311
}
13061312
}
13071313

0 commit comments

Comments
 (0)