From: bmancini55 Date: Tue, 9 Mar 2021 21:30:52 +0000 (-0500) Subject: Clean up iteration in handle_query_channel_range X-Git-Tag: v0.0.14~48^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=deffb4a3d8c3d95fa95f2e59688b0da2cd8bb905;p=rust-lightning Clean up iteration in handle_query_channel_range Refactor to use an enumerator in NetGraphMsgHandler::handle_query_channel_range --- 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(())