X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fshutdown_tests.rs;h=4f0675182f4caa328282d7af80fcaa1ca3ac4534;hb=b4a40f6b409a54f586ba560ecb1d5ab002c3e8f3;hp=58d505943a686dbd625f387b756624654f42b98d;hpb=0a2a40c4fd05f39b9485cc0f000f7066636783cb;p=rust-lightning diff --git a/lightning/src/ln/shutdown_tests.rs b/lightning/src/ln/shutdown_tests.rs index 58d50594..4f067518 100644 --- a/lightning/src/ln/shutdown_tests.rs +++ b/lightning/src/ln/shutdown_tests.rs @@ -37,7 +37,7 @@ use ln::msgs::OptionalField::Present; #[test] fn pre_funding_lock_shutdown_test() { - // Test sending a shutdown prior to funding_locked after funding generation + // Test sending a shutdown prior to channel_ready after funding generation let chanmon_cfgs = create_chanmon_cfgs(2); let node_cfgs = create_node_cfgs(2, &chanmon_cfgs); let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]); @@ -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);