@@ -139,7 +139,10 @@ fn test_monitor_and_persister_update_fail() {
139
139
let updates = get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 0 ] . node. get_our_node_id( ) ) ;
140
140
assert_eq ! ( updates. update_fulfill_htlcs. len( ) , 1 ) ;
141
141
nodes[ 0 ] . node . handle_update_fulfill_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & updates. update_fulfill_htlcs [ 0 ] ) ;
142
- if let Some ( ref mut channel) = nodes[ 0 ] . node . channel_state . lock ( ) . unwrap ( ) . by_id . get_mut ( & chan. 2 ) {
142
+ {
143
+ let mut node_0_per_peer_lock;
144
+ let mut node_0_peer_state_lock;
145
+ let mut channel = get_channel_ref ! ( nodes[ 0 ] , nodes[ 1 ] , node_0_per_peer_lock, node_0_peer_state_lock, chan. 2 ) ;
143
146
if let Ok ( ( _, _, update) ) = channel. commitment_signed ( & updates. commitment_signed , & node_cfgs[ 0 ] . logger ) {
144
147
// Check that even though the persister is returning a InProgress,
145
148
// because the update is bogus, ultimately the error that's returned
@@ -148,7 +151,7 @@ fn test_monitor_and_persister_update_fail() {
148
151
logger. assert_log_regex ( "lightning::chain::chainmonitor" . to_string ( ) , regex:: Regex :: new ( "Persistence of ChannelMonitorUpdate for channel [0-9a-f]* in progress" ) . unwrap ( ) , 1 ) ;
149
152
assert_eq ! ( nodes[ 0 ] . chain_monitor. update_channel( outpoint, update) , ChannelMonitorUpdateStatus :: Completed ) ;
150
153
} else { assert ! ( false ) ; }
151
- } else { assert ! ( false ) ; } ;
154
+ }
152
155
153
156
check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
154
157
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
@@ -932,7 +935,8 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
932
935
933
936
// Note that the ordering of the events for different nodes is non-prescriptive, though the
934
937
// ordering of the two events that both go to nodes[2] have to stay in the same order.
935
- let messages_a = match events_3. pop ( ) . unwrap ( ) {
938
+ let ( nodes_0_event, events_3) = remove_first_msg_event_to_node ( & nodes[ 0 ] . node . get_our_node_id ( ) , & events_3) ;
939
+ let messages_a = match nodes_0_event {
936
940
MessageSendEvent :: UpdateHTLCs { node_id, mut updates } => {
937
941
assert_eq ! ( node_id, nodes[ 0 ] . node. get_our_node_id( ) ) ;
938
942
assert ! ( updates. update_fulfill_htlcs. is_empty( ) ) ;
@@ -944,17 +948,21 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
944
948
} ,
945
949
_ => panic ! ( "Unexpected event type!" ) ,
946
950
} ;
951
+
952
+ let ( nodes_2_event, events_3) = remove_first_msg_event_to_node ( & nodes[ 2 ] . node . get_our_node_id ( ) , & events_3) ;
953
+ let send_event_b = SendEvent :: from_event ( nodes_2_event) ;
954
+ assert_eq ! ( send_event_b. node_id, nodes[ 2 ] . node. get_our_node_id( ) ) ;
955
+
947
956
let raa = if test_ignore_second_cs {
948
- match events_3. remove ( 1 ) {
957
+ let ( nodes_2_event, _events_3) = remove_first_msg_event_to_node ( & nodes[ 2 ] . node . get_our_node_id ( ) , & events_3) ;
958
+ match nodes_2_event {
949
959
MessageSendEvent :: SendRevokeAndACK { node_id, msg } => {
950
960
assert_eq ! ( node_id, nodes[ 2 ] . node. get_our_node_id( ) ) ;
951
961
Some ( msg. clone ( ) )
952
962
} ,
953
963
_ => panic ! ( "Unexpected event" ) ,
954
964
}
955
965
} else { None } ;
956
- let send_event_b = SendEvent :: from_event ( events_3. remove ( 0 ) ) ;
957
- assert_eq ! ( send_event_b. node_id, nodes[ 2 ] . node. get_our_node_id( ) ) ;
958
966
959
967
// Now deliver the new messages...
960
968
@@ -988,6 +996,7 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
988
996
check_added_monitors ! ( nodes[ 2 ] , 1 ) ;
989
997
990
998
let bs_revoke_and_commit = nodes[ 2 ] . node . get_and_clear_pending_msg_events ( ) ;
999
+ // As both messages are for nodes[1], they're in order.
991
1000
assert_eq ! ( bs_revoke_and_commit. len( ) , 2 ) ;
992
1001
match bs_revoke_and_commit[ 0 ] {
993
1002
MessageSendEvent :: SendRevokeAndACK { ref node_id, ref msg } => {
@@ -1415,9 +1424,12 @@ fn monitor_failed_no_reestablish_response() {
1415
1424
let mut nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
1416
1425
let channel_id = create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager:: provided_init_features ( ) , channelmanager:: provided_init_features ( ) ) . 2 ;
1417
1426
{
1418
- let mut lock;
1419
- get_channel_ref ! ( nodes[ 0 ] , lock, channel_id) . announcement_sigs_state = AnnouncementSigsState :: PeerReceived ;
1420
- get_channel_ref ! ( nodes[ 1 ] , lock, channel_id) . announcement_sigs_state = AnnouncementSigsState :: PeerReceived ;
1427
+ let mut node_0_per_peer_lock;
1428
+ let mut node_0_peer_state_lock;
1429
+ let mut node_1_per_peer_lock;
1430
+ let mut node_1_peer_state_lock;
1431
+ get_channel_ref ! ( nodes[ 0 ] , nodes[ 1 ] , node_0_per_peer_lock, node_0_peer_state_lock, channel_id) . announcement_sigs_state = AnnouncementSigsState :: PeerReceived ;
1432
+ get_channel_ref ! ( nodes[ 1 ] , nodes[ 0 ] , node_1_per_peer_lock, node_1_peer_state_lock, channel_id) . announcement_sigs_state = AnnouncementSigsState :: PeerReceived ;
1421
1433
}
1422
1434
1423
1435
// Route the payment and deliver the initial commitment_signed (with a monitor update failure
0 commit comments