Skip to content

Commit deffb4a

Browse files
committed
Clean up iteration in handle_query_channel_range
Refactor to use an enumerator in NetGraphMsgHandler::handle_query_channel_range
1 parent dd0bb25 commit deffb4a

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lightning/src/routing/network_graph.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,8 @@ impl<C: Deref + Sync + Send, L: Deref + Sync + Send> RoutingMessageHandler for N
369369
drop(network_graph);
370370

371371
let mut pending_events = self.pending_events.lock().unwrap();
372-
let mut batch_index = 0;
373372
let batch_count = batches.len();
374-
for batch in batches.into_iter() {
373+
for (batch_index, batch) in batches.into_iter().enumerate() {
375374
// Per spec, the initial first_blocknum needs to be <= the query's first_blocknum.
376375
// Use the query's values since we don't use pre-processed reply ranges.
377376
let first_blocknum = if batch_index == 0 {
@@ -409,8 +408,6 @@ impl<C: Deref + Sync + Send, L: Deref + Sync + Send> RoutingMessageHandler for N
409408
short_channel_ids: batch,
410409
}
411410
});
412-
413-
batch_index += 1;
414411
}
415412

416413
Ok(())

0 commit comments

Comments
 (0)