Send channel_{announcement,update} msgs on connection, not timer
[rust-lightning] / lightning / src / ln / shutdown_tests.rs
index 3dc245877e759fb8816ba0faa846f42386040f1a..4f0675182f4caa328282d7af80fcaa1ca3ac4534 100644 (file)
@@ -248,9 +248,9 @@ fn do_test_shutdown_rebroadcast(recv_count: u8) {
        nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
 
        nodes[0].node.peer_connected(&nodes[1].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty(), remote_network_address: None });
-       let node_0_reestablish = get_event_msg!(nodes[0], MessageSendEvent::SendChannelReestablish, nodes[1].node.get_our_node_id());
+       let node_0_reestablish = get_chan_reestablish_msgs!(nodes[0], nodes[1]).pop().unwrap();
        nodes[1].node.peer_connected(&nodes[0].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty(), remote_network_address: None });
-       let node_1_reestablish = get_event_msg!(nodes[1], MessageSendEvent::SendChannelReestablish, nodes[0].node.get_our_node_id());
+       let node_1_reestablish = get_chan_reestablish_msgs!(nodes[1], nodes[0]).pop().unwrap();
 
        nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &node_0_reestablish);
        let node_1_2nd_shutdown = get_event_msg!(nodes[1], MessageSendEvent::SendShutdown, nodes[0].node.get_our_node_id());
@@ -310,11 +310,11 @@ fn do_test_shutdown_rebroadcast(recv_count: u8) {
        nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
 
        nodes[1].node.peer_connected(&nodes[0].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty(), remote_network_address: None });
-       let node_1_2nd_reestablish = get_event_msg!(nodes[1], MessageSendEvent::SendChannelReestablish, nodes[0].node.get_our_node_id());
+       let node_1_2nd_reestablish = get_chan_reestablish_msgs!(nodes[1], nodes[0]).pop().unwrap();
        nodes[0].node.peer_connected(&nodes[1].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty(), remote_network_address: None });
        if recv_count == 0 {
                // If all closing_signeds weren't delivered we can just resume where we left off...
-               let node_0_2nd_reestablish = get_event_msg!(nodes[0], MessageSendEvent::SendChannelReestablish, nodes[1].node.get_our_node_id());
+               let node_0_2nd_reestablish = get_chan_reestablish_msgs!(nodes[0], nodes[1]).pop().unwrap();
 
                nodes[0].node.handle_channel_reestablish(&nodes[1].node.get_our_node_id(), &node_1_2nd_reestablish);
                let node_0_msgs = nodes[0].node.get_and_clear_pending_msg_events();
@@ -409,9 +409,9 @@ fn test_upfront_shutdown_script() {
        // enforce it at shutdown message
 
        let mut config = UserConfig::default();
-       config.channel_options.announced_channel = true;
-       config.peer_channel_config_limits.force_announced_channel_preference = false;
-       config.channel_options.commit_upfront_shutdown_pubkey = false;
+       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_limits.force_announced_channel_preference = false;
+       config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
        let user_cfgs = [None, Some(config), None];
        let chanmon_cfgs = create_chanmon_cfgs(3);
        let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
@@ -574,9 +574,9 @@ fn test_invalid_upfront_shutdown_script() {
 #[test]
 fn test_segwit_v0_shutdown_script() {
        let mut config = UserConfig::default();
-       config.channel_options.announced_channel = true;
-       config.peer_channel_config_limits.force_announced_channel_preference = false;
-       config.channel_options.commit_upfront_shutdown_pubkey = false;
+       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_limits.force_announced_channel_preference = false;
+       config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
        let user_cfgs = [None, Some(config), None];
        let chanmon_cfgs = create_chanmon_cfgs(3);
        let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
@@ -609,9 +609,9 @@ fn test_segwit_v0_shutdown_script() {
 #[test]
 fn test_anysegwit_shutdown_script() {
        let mut config = UserConfig::default();
-       config.channel_options.announced_channel = true;
-       config.peer_channel_config_limits.force_announced_channel_preference = false;
-       config.channel_options.commit_upfront_shutdown_pubkey = false;
+       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_limits.force_announced_channel_preference = false;
+       config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
        let user_cfgs = [None, Some(config), None];
        let chanmon_cfgs = create_chanmon_cfgs(3);
        let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
@@ -644,9 +644,9 @@ fn test_anysegwit_shutdown_script() {
 #[test]
 fn test_unsupported_anysegwit_shutdown_script() {
        let mut config = UserConfig::default();
-       config.channel_options.announced_channel = true;
-       config.peer_channel_config_limits.force_announced_channel_preference = false;
-       config.channel_options.commit_upfront_shutdown_pubkey = false;
+       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_limits.force_announced_channel_preference = false;
+       config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
        let user_cfgs = [None, Some(config), None];
        let chanmon_cfgs = create_chanmon_cfgs(3);
        let mut node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
@@ -686,9 +686,9 @@ fn test_unsupported_anysegwit_shutdown_script() {
 #[test]
 fn test_invalid_shutdown_script() {
        let mut config = UserConfig::default();
-       config.channel_options.announced_channel = true;
-       config.peer_channel_config_limits.force_announced_channel_preference = false;
-       config.channel_options.commit_upfront_shutdown_pubkey = false;
+       config.channel_handshake_config.announced_channel = true;
+       config.channel_handshake_limits.force_announced_channel_preference = false;
+       config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
        let user_cfgs = [None, Some(config), None];
        let chanmon_cfgs = create_chanmon_cfgs(3);
        let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);