Skip to content

Commit 7a99de2

Browse files
committed
Fix test, reducing coverage slightly.
1 parent 063aff4 commit 7a99de2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,11 +1878,11 @@ mod tests {
18781878
// RoutingMessageHandlers that intentionally return more channel messages
18791879
// than can fit into a peer's buffer).
18801880
let (mut fd_a, mut fd_b) = establish_connection(&peers[0], &peers[1]);
1881+
peers[0].process_events();
18811882

18821883
// Make each peer to read the messages that the other peer just wrote to them. Note that
18831884
// due to the max-message-before-ping limits this may take a few iterations to complete.
18841885
for _ in 0..150/super::BUFFER_DRAIN_MSGS_PER_TICK + 1 {
1885-
peers[0].process_events();
18861886
let b_read_data = fd_a.outbound_data.lock().unwrap().split_off(0);
18871887
assert!(!b_read_data.is_empty());
18881888

@@ -1891,12 +1891,16 @@ mod tests {
18911891

18921892
let a_read_data = fd_b.outbound_data.lock().unwrap().split_off(0);
18931893
assert!(!a_read_data.is_empty());
1894-
peers[0].read_event(&mut fd_a, &a_read_data).unwrap();
18951894

1896-
peers[1].process_events();
1897-
assert_eq!(fd_b.outbound_data.lock().unwrap().len(), 0, "Until B receives data, it shouldn't send more messages");
1895+
peers[0].read_event(&mut fd_a, &a_read_data).unwrap();
1896+
peers[0].process_events();
18981897
}
18991898

1899+
let b_remaining_data = fd_a.outbound_data.lock().unwrap().split_off(0);
1900+
peers[1].read_event(&mut fd_b, &b_remaining_data).unwrap();
1901+
peers[1].process_events();
1902+
assert_eq!(fd_b.outbound_data.lock().unwrap().len(), 0, "Until B receives data, it shouldn't send more messages");
1903+
19001904
// Check that each peer has received the expected number of channel updates and channel
19011905
// announcements.
19021906
assert_eq!(cfgs[0].routing_handler.chan_upds_recvd.load(Ordering::Acquire), 100);

0 commit comments

Comments
 (0)