Skip to content

Commit c70e6d3

Browse files
update functional test and check warn message instead of a close channel
Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent 8c7dca8 commit c70e6d3

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

lightning/src/ln/functional_tests.rs

+17-5
Original file line numberDiff line numberDiff line change
@@ -7380,12 +7380,23 @@ fn test_data_loss_protect() {
73807380
}
73817381

73827382
// Check we close channel detecting A is fallen-behind
7383-
nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &reestablish_1[0]);
7384-
check_closed_event!(nodes[1], 1, ClosureReason::ProcessingError { err: "Peer attempted to reestablish channel with a very old local commitment transaction".to_string() });
7385-
assert_eq!(check_closed_broadcast!(nodes[1], true).unwrap().data, "Peer attempted to reestablish channel with a very old local commitment transaction");
7386-
check_added_monitors!(nodes[1], 1);
7383+
// Check if we sent the warning message when we detecting that A is fallen-behind,
7384+
// and we give the possibility to A to be able to recover from error.
7385+
for msg in nodes[1].node.get_and_clear_pending_msg_events() {
7386+
if let MessageSendEvent::HandleError { ref action, .. } = msg {
7387+
match action {
7388+
&ErrorAction::SendWarningMessage { ref msg, .. } => {
7389+
assert!(msg.data.contains(&"Peer attempted to reestablish channel with a very old local commitment transaction".to_owned()));
7390+
},
7391+
_ => panic!("Unexpected event!"),
7392+
}
7393+
} else {
7394+
panic!("Unexpected event")
7395+
}
7396+
}
73877397

7388-
// Check A is able to claim to_remote output
7398+
// FIXME: On the A side, check how we need to manage the warning message received.
7399+
/*
73897400
let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().clone();
73907401
assert_eq!(node_txn.len(), 1);
73917402
check_spends!(node_txn[0], chan.3);
@@ -7396,6 +7407,7 @@ fn test_data_loss_protect() {
73967407
let spend_txn = check_spendable_outputs!(nodes[0], node_cfgs[0].keys_manager);
73977408
assert_eq!(spend_txn.len(), 1);
73987409
check_spends!(spend_txn[0], node_txn[0]);
7410+
*/
73997411
}
74007412

74017413
#[test]

0 commit comments

Comments
 (0)