Add test of an initial message other than `Init`
[rust-lightning] / lightning / src / ln / priv_short_conf_tests.rs
index aca781b9fd6f50ef2908d4fa518678c932ec522f..adc2b59abbf4b3180ab6650e5433305b1fb112ef 100644 (file)
@@ -66,7 +66,7 @@ fn test_priv_forwarding_rejection() {
                htlc_maximum_msat: None,
        }]);
        let last_hops = vec![route_hint];
-       let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id())
+       let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id(), TEST_FINAL_CLTV)
                .with_features(nodes[2].node.invoice_features())
                .with_route_hints(last_hops);
        let (route, our_payment_hash, our_payment_preimage, our_payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[2], payment_params, 10_000, TEST_FINAL_CLTV);
@@ -184,14 +184,14 @@ fn do_test_1_conf_open(connect_style: ConnectStyle) {
                msg.clone()
        } else { panic!("Unexpected event"); };
        let (bs_announcement, bs_update) = if let MessageSendEvent::BroadcastChannelAnnouncement { ref msg, ref update_msg } = bs_announce_events[1] {
-               (msg.clone(), update_msg.clone())
+               (msg.clone(), update_msg.clone().unwrap())
        } else { panic!("Unexpected event"); };
 
        nodes[0].node.handle_announcement_signatures(&nodes[1].node.get_our_node_id(), &bs_announcement_sigs);
        let as_announce_events = nodes[0].node.get_and_clear_pending_msg_events();
        assert_eq!(as_announce_events.len(), 1);
        let (announcement, as_update) = if let MessageSendEvent::BroadcastChannelAnnouncement { ref msg, ref update_msg } = as_announce_events[0] {
-               (msg.clone(), update_msg.clone())
+               (msg.clone(), update_msg.clone().unwrap())
        } else { panic!("Unexpected event"); };
        assert_eq!(announcement, bs_announcement);
 
@@ -233,7 +233,7 @@ fn test_routed_scid_alias() {
                htlc_maximum_msat: None,
                htlc_minimum_msat: None,
        }])];
-       let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id())
+       let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id(), 42)
                .with_features(nodes[2].node.invoice_features())
                .with_route_hints(hop_hints);
        let (route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[2], payment_params, 100_000, 42);
@@ -388,7 +388,7 @@ fn test_inbound_scid_privacy() {
                htlc_maximum_msat: None,
                htlc_minimum_msat: None,
        }])];
-       let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id())
+       let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id(), 42)
                .with_features(nodes[2].node.invoice_features())
                .with_route_hints(hop_hints.clone());
        let (route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[2], payment_params, 100_000, 42);
@@ -403,7 +403,7 @@ fn test_inbound_scid_privacy() {
        // what channel we're talking about.
        hop_hints[0].0[0].short_channel_id = last_hop[0].short_channel_id.unwrap();
 
-       let payment_params_2 = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id())
+       let payment_params_2 = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id(), 42)
                .with_features(nodes[2].node.invoice_features())
                .with_route_hints(hop_hints);
        let (route_2, payment_hash_2, _, payment_secret_2) = get_route_and_payment_hash!(nodes[0], nodes[2], payment_params_2, 100_000, 42);
@@ -454,7 +454,7 @@ fn test_scid_alias_returned() {
                htlc_maximum_msat: None,
                htlc_minimum_msat: None,
        }])];
-       let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id())
+       let payment_params = PaymentParameters::from_node_id(nodes[2].node.get_our_node_id(), 42)
                .with_features(nodes[2].node.invoice_features())
                .with_route_hints(hop_hints);
        let (mut route, payment_hash, _, payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[2], payment_params, 10_000, 42);
@@ -757,7 +757,7 @@ fn test_public_0conf_channel() {
        match bs_announcement[0] {
                MessageSendEvent::BroadcastChannelAnnouncement { ref msg, ref update_msg } => {
                        announcement = msg.clone();
-                       bs_update = update_msg.clone();
+                       bs_update = update_msg.clone().unwrap();
                },
                _ => panic!("Unexpected event"),
        };
@@ -767,6 +767,7 @@ fn test_public_0conf_channel() {
        match as_announcement[0] {
                MessageSendEvent::BroadcastChannelAnnouncement { ref msg, ref update_msg } => {
                        assert!(announcement == *msg);
+                       let update_msg = update_msg.as_ref().unwrap();
                        assert_eq!(update_msg.contents.short_channel_id, scid);
                        assert_eq!(update_msg.contents.short_channel_id, announcement.contents.short_channel_id);
                        assert_eq!(update_msg.contents.short_channel_id, bs_update.contents.short_channel_id);