Skip to content

Commit 0f24e79

Browse files
committed
Simplify+expand per-channel check in test_announce_disable_channels
1 parent 09ef3f0 commit 0f24e79

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lightning/src/ln/functional_tests.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7586,13 +7586,13 @@ fn test_announce_disable_channels() {
75867586
nodes[0].node.timer_tick_occurred(); // DisabledStaged -> Disabled
75877587
let msg_events = nodes[0].node.get_and_clear_pending_msg_events();
75887588
assert_eq!(msg_events.len(), 3);
7589+
let mut chans_disabled: HashSet<u64> = [short_id_1, short_id_2, short_id_3].iter().map(|a| *a).collect();
75897590
for e in msg_events {
75907591
match e {
75917592
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
75927593
assert_eq!(msg.contents.flags & (1<<1), 1<<1); // The "channel disabled" bit should be set
7593-
let short_id = msg.contents.short_channel_id;
7594-
// Check generated channel_update match list in PendingChannelUpdate
7595-
if short_id != short_id_1 && short_id != short_id_2 && short_id != short_id_3 {
7594+
// Check that each channel gets updated exactly once
7595+
if !chans_disabled.remove(&msg.contents.short_channel_id) {
75967596
panic!("Generated ChannelUpdate for wrong chan!");
75977597
}
75987598
},
@@ -7628,13 +7628,13 @@ fn test_announce_disable_channels() {
76287628
nodes[0].node.timer_tick_occurred();
76297629
let msg_events = nodes[0].node.get_and_clear_pending_msg_events();
76307630
assert_eq!(msg_events.len(), 3);
7631+
chans_disabled = [short_id_1, short_id_2, short_id_3].iter().map(|a| *a).collect();
76317632
for e in msg_events {
76327633
match e {
76337634
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
76347635
assert_eq!(msg.contents.flags & (1<<1), 0); // The "channel disabled" bit should be off
7635-
let short_id = msg.contents.short_channel_id;
7636-
// Check generated channel_update match list in PendingChannelUpdate
7637-
if short_id != short_id_1 && short_id != short_id_2 && short_id != short_id_3 {
7636+
// Check that each channel gets updated exactly once
7637+
if !chans_disabled.remove(&msg.contents.short_channel_id) {
76387638
panic!("Generated ChannelUpdate for wrong chan!");
76397639
}
76407640
},

0 commit comments

Comments
 (0)