Skip to content

Commit 55c2050

Browse files
committed
f msrv
1 parent 091ab7a commit 55c2050

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lightning-block-sync/src/init.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,15 @@ where
191191
*result = Some((header.height, block_res?));
192192
}
193193
debug_assert!(fetched_blocks.iter().take(most_connected_blocks.len()).all(|r| r.is_some()));
194-
debug_assert!(fetched_blocks
195-
.is_sorted_by_key(|r| r.as_ref().map(|(height, _)| *height).unwrap_or(u32::MAX)));
194+
// TODO: When our MSRV is 1.82, use is_sorted_by_key
195+
debug_assert!(fetched_blocks.windows(2).all(|blocks| {
196+
if let (Some(a), Some(b)) = (&blocks[0], &blocks[1]) {
197+
a.0 < b.0
198+
} else {
199+
// Any non-None blocks have to come before any None entries
200+
blocks[1].is_none()
201+
}
202+
}));
196203

197204
for (listener_height, listener) in chain_listeners_at_height.iter() {
198205
// Connect blocks for this listener.

0 commit comments

Comments
 (0)