diff --git a/lightning/src/ln/functional_tests.rs b/lightning/src/ln/functional_tests.rs index d7bebca0e4d..f359a93e957 100644 --- a/lightning/src/ln/functional_tests.rs +++ b/lightning/src/ln/functional_tests.rs @@ -7380,10 +7380,20 @@ fn test_data_loss_protect() { } // Check we close channel detecting A is fallen-behind - nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &reestablish_1[0]); - check_closed_event!(nodes[1], 1, ClosureReason::ProcessingError { err: "Peer attempted to reestablish channel with a very old local commitment transaction".to_string() }); - assert_eq!(check_closed_broadcast!(nodes[1], true).unwrap().data, "Peer attempted to reestablish channel with a very old local commitment transaction"); - check_added_monitors!(nodes[1], 1); + // Check if we sent the warning message when we detecting that A is fallen-behind, + // and we give the possibility to A to be able to recover from error. + for msg in nodes[1].node.get_and_clear_pending_msg_events() { + if let MessageSendEvent::HandleError { ref action, .. } = msg { + match action { + &ErrorAction::SendWarningMessage { ref msg, .. } => { + assert!(msg.data.contains(&"bad reestablish revocation_number".to_owned())); + }, + _ => panic!("Unexpected event!"), + } + } else { + panic!("Unexpected event") + } + } // Check A is able to claim to_remote output let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().clone();