Skip to content

Commit

Permalink
update functional test and check warn message instead of a close channel
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo committed Apr 22, 2022
1 parent 95b1188 commit fc33225
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lightning/src/ln/functional_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit fc33225

Please sign in to comment.