From: Philip Robinson Date: Mon, 21 Jan 2019 12:54:19 +0000 (+0200) Subject: Addressing PR comments X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=7219b7df6bd8d87400bda1651413e2cc2bce8cdf;p=rust-lightning Addressing PR comments --- diff --git a/src/ln/functional_tests.rs b/src/ln/functional_tests.rs index a51917378..8c0fbded2 100644 --- a/src/ln/functional_tests.rs +++ b/src/ln/functional_tests.rs @@ -6736,10 +6736,7 @@ fn test_update_add_htlc_bolt2_receiver_check_amount_received_more_than_min() { } else { assert!(false); } - //Confirm the channel was closed - { - assert_eq!(nodes[1].node.channel_state.lock().unwrap().by_id.len(), 0); - } + assert!(nodes[1].node.list_channels().is_empty()); check_closed_broadcast!(nodes[1]); } @@ -6768,10 +6765,7 @@ fn test_update_add_htlc_bolt2_receiver_sender_can_afford_amount_sent() { assert!(false); } - //Confirm the channel was closed - { - assert_eq!(nodes[1].node.channel_state.lock().unwrap().by_id.len(), 0); - } + assert!(nodes[1].node.list_channels().is_empty()); check_closed_broadcast!(nodes[1]); } @@ -6821,10 +6815,7 @@ fn test_update_add_htlc_bolt2_receiver_check_max_htlc_limit() { assert!(false); } - //Confirm the channel was closed - { - assert_eq!(nodes[1].node.channel_state.lock().unwrap().by_id.len(), 0); - } + assert!(nodes[1].node.list_channels().is_empty()); check_closed_broadcast!(nodes[1]); } @@ -6849,12 +6840,8 @@ fn test_update_add_htlc_bolt2_receiver_check_max_in_flight_msat() { assert!(false); } - //Confirm the channel was closed - { - assert_eq!(nodes[1].node.channel_state.lock().unwrap().by_id.len(), 0); - } - //Clear unhandled msg events. - let _ = nodes[1].node.get_and_clear_pending_msg_events(); + assert!(nodes[1].node.list_channels().is_empty()); + check_closed_broadcast!(nodes[1]); } #[test] @@ -6878,10 +6865,7 @@ fn test_update_add_htlc_bolt2_receiver_check_cltv_expiry() { assert!(false); } - //Confirm the channel was closed - { - assert_eq!(nodes[1].node.channel_state.lock().unwrap().by_id.len(), 0); - } + assert!(nodes[1].node.list_channels().is_empty()); check_closed_broadcast!(nodes[1]); } @@ -6894,7 +6878,7 @@ fn test_update_add_htlc_bolt2_receiver_check_repeated_id_ignore() { let (_, our_payment_hash) = get_payment_preimage_hash!(nodes[0]); nodes[0].node.send_payment(route, our_payment_hash).unwrap(); check_added_monitors!(nodes[0], 1); - let mut updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id()); + let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id()); let _ = nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]); assert_eq!(nodes[1].node.channel_state.lock().unwrap().by_id.get(&chan.2).unwrap().next_remote_htlc_id, 1);