Skip to content

Commit bd55c19

Browse files
committed
f - fix tests
1 parent 0543f49 commit bd55c19

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

lightning/src/ln/resource_manager.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,13 +1549,18 @@ mod tests {
15491549
) {
15501550
let channels = rm.channels.lock().unwrap();
15511551
let channel = channels.get(&incoming_scid).unwrap();
1552-
let slots = channel.general_bucket.channels_slots.get(&outgoing_scid).unwrap();
1553-
let used_count = slots
1554-
.iter()
1555-
.filter(|slot_idx| {
1556-
channel.general_bucket.slots_occupied[**slot_idx as usize] == Some(outgoing_scid)
1557-
})
1558-
.count();
1552+
let general_bucket = &channel.general_bucket;
1553+
let slots = general_bucket.channels_slots.get(&outgoing_scid).unwrap();
1554+
1555+
let mut used_count = 0;
1556+
for entry in slots {
1557+
if slot_used(*entry) {
1558+
// A slot flagged as used by this channel must also be marked occupied in the
1559+
// bucket-wide bitset.
1560+
assert!(general_bucket.is_slot_occupied(slot_index(*entry)));
1561+
used_count += 1;
1562+
}
1563+
}
15591564
assert_eq!(used_count, expected_count);
15601565
}
15611566

0 commit comments

Comments
 (0)