From deffb4a3d8c3d95fa95f2e59688b0da2cd8bb905 Mon Sep 17 00:00:00 2001 From: bmancini55 Date: Tue, 9 Mar 2021 16:30:52 -0500 Subject: [PATCH] Clean up iteration in handle_query_channel_range Refactor to use an enumerator in NetGraphMsgHandler::handle_query_channel_range --- lightning/src/routing/network_graph.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lightning/src/routing/network_graph.rs b/lightning/src/routing/network_graph.rs index b8655fb0a..44ee21ab8 100644 --- a/lightning/src/routing/network_graph.rs +++ b/lightning/src/routing/network_graph.rs @@ -369,9 +369,8 @@ impl RoutingMessageHandler for N drop(network_graph); let mut pending_events = self.pending_events.lock().unwrap(); - let mut batch_index = 0; let batch_count = batches.len(); - for batch in batches.into_iter() { + for (batch_index, batch) in batches.into_iter().enumerate() { // Per spec, the initial first_blocknum needs to be <= the query's first_blocknum. // Use the query's values since we don't use pre-processed reply ranges. let first_blocknum = if batch_index == 0 { @@ -409,8 +408,6 @@ impl RoutingMessageHandler for N short_channel_ids: batch, } }); - - batch_index += 1; } Ok(()) -- 2.39.5