Skip to content

Commit 16002cd

Browse files
committed
Expand event test suite
Expand testing to ensure proper serialise-deserialise round-trip for all events.
1 parent 4bfd89e commit 16002cd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lightning/src/ln/channelmanager.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -10929,7 +10929,18 @@ where
1092910929
let events = core::cell::RefCell::new(Vec::new());
1093010930
let event_handler = |event: events::Event| Ok(events.borrow_mut().push(event));
1093110931
self.process_pending_events(&event_handler);
10932-
events.into_inner()
10932+
let collected_events = events.into_inner();
10933+
10934+
// To expand the coverage and make sure all events are properly serialised and deserialised,
10935+
// we test all generated events round-trip:
10936+
for event in &collected_events {
10937+
let ser = event.encode();
10938+
if let Some(deser) = events::Event::read(&mut &ser[..]).expect("event should deserialize") {
10939+
assert_eq!(&deser, event, "event should roundtrip correctly");
10940+
}
10941+
}
10942+
10943+
collected_events
1093310944
}
1093410945

1093510946
#[cfg(feature = "_test_utils")]

0 commit comments

Comments
 (0)