Merge pull request #2795 from TheBlueMatt/2023-11-robuster-chan-to-peer
[rust-lightning] / lightning / src / ln / functional_test_utils.rs
index 5828ca8038ca241a8d8c6d96464cbe3555bfc1ef..a2d9631716c4c23098135a8f95ee37a1fc5a6949 100644 (file)
@@ -1536,6 +1536,18 @@ pub struct ExpectedCloseEvent {
        pub reason: Option<ClosureReason>,
 }
 
+impl ExpectedCloseEvent {
+       pub fn from_id_reason(channel_id: ChannelId, discard_funding: bool, reason: ClosureReason) -> Self {
+               Self {
+                       channel_capacity_sats: None,
+                       channel_id: Some(channel_id),
+                       counterparty_node_id: None,
+                       discard_funding,
+                       reason: Some(reason),
+               }
+       }
+}
+
 /// Check that multiple channel closing events have been issued.
 pub fn check_closed_events(node: &Node, expected_close_events: &[ExpectedCloseEvent]) {
        let closed_events_count = expected_close_events.len();