Skip to content

Commit 9dca9c8

Browse files
committed
Update the relevant tests to account for the new behavior change
1 parent 576d9f2 commit 9dca9c8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lightning/src/ln/functional_tests.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -3692,7 +3692,7 @@ fn test_dup_events_on_peer_disconnect() {
36923692
#[test]
36933693
fn test_peer_disconnected_before_funding_broadcasted() {
36943694
// Test that channels are closed with `ClosureReason::DisconnectedPeer` if the peer disconnects
3695-
// before the funding transaction has been broadcasted.
3695+
// before the funding transaction has been broadcasted, and doesn't reconnect back within time.
36963696
let chanmon_cfgs = create_chanmon_cfgs(2);
36973697
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
36983698
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
@@ -3721,11 +3721,15 @@ fn test_peer_disconnected_before_funding_broadcasted() {
37213721
assert_eq!(nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().len(), 0);
37223722
}
37233723

3724-
// Ensure that the channel is closed with `ClosureReason::DisconnectedPeer` when the peers are
3725-
// disconnected before the funding transaction was broadcasted.
3724+
// Ensure that the channel is closed after timeout with `ClosureReason::DisconnectedPeer`
3725+
// when the peers are disconnected before the funding transaction was broadcasted.
37263726
nodes[0].node.peer_disconnected(&nodes[1].node.get_our_node_id());
37273727
nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id());
37283728

3729+
// The timer ticks while waiting for peer to connect back
3730+
nodes[0].node.timer_tick_occurred();
3731+
nodes[0].node.timer_tick_occurred();
3732+
37293733
check_closed_event!(&nodes[0], 2, ClosureReason::DisconnectedPeer, true
37303734
, [nodes[1].node.get_our_node_id()], 1000000);
37313735
check_closed_event!(&nodes[1], 1, ClosureReason::DisconnectedPeer, false
@@ -10526,6 +10530,10 @@ fn test_disconnect_in_funding_batch() {
1052610530
// The remaining peer in the batch disconnects.
1052710531
nodes[0].node.peer_disconnected(&nodes[2].node.get_our_node_id());
1052810532

10533+
// After the time expires for allowing peer to connect back
10534+
nodes[0].node.timer_tick_occurred();
10535+
nodes[0].node.timer_tick_occurred();
10536+
1052910537
// The channels in the batch will close immediately.
1053010538
let channel_id_1 = OutPoint { txid: tx.txid(), index: 0 }.to_channel_id();
1053110539
let channel_id_2 = OutPoint { txid: tx.txid(), index: 1 }.to_channel_id();

0 commit comments

Comments
 (0)