diff --git a/crates/subspace-farmer/src/bin/subspace-farmer/commands/shared/network.rs b/crates/subspace-farmer/src/bin/subspace-farmer/commands/shared/network.rs index 29b5129c4e..8a3eda376b 100644 --- a/crates/subspace-farmer/src/bin/subspace-farmer/commands/shared/network.rs +++ b/crates/subspace-farmer/src/bin/subspace-farmer/commands/shared/network.rs @@ -199,11 +199,10 @@ where match internal_result { Ok(segment_headers) => segment_headers .into_iter() - .map(|maybe_segment_header| { + .inspect(|maybe_segment_header| { if maybe_segment_header.is_none() { error!("Received empty optional segment header!"); } - maybe_segment_header }) .collect::>>() .map(|segment_headers| SegmentHeaderResponse { segment_headers }), diff --git a/crates/subspace-farmer/src/node_client/caching_proxy_node_client.rs b/crates/subspace-farmer/src/node_client/caching_proxy_node_client.rs index 3b1bf5c1df..33bf6856fb 100644 --- a/crates/subspace-farmer/src/node_client/caching_proxy_node_client.rs +++ b/crates/subspace-farmer/src/node_client/caching_proxy_node_client.rs @@ -52,7 +52,6 @@ impl SegmentHeaders { .copied() .rev() .take(limit as usize) - .rev() .map(Some) .collect() } @@ -88,10 +87,7 @@ impl SegmentHeaders { break 'outer; }; - if self.segment_headers.len() == u64::from(segment_header.segment_index()) as usize - { - self.segment_headers.push(segment_header); - } + self.push(segment_header); } segment_index_offset += segment_index_step; diff --git a/crates/subspace-networking/src/protocols/request_response/handlers/segment_header.rs b/crates/subspace-networking/src/protocols/request_response/handlers/segment_header.rs index adf3425916..7bb2c603d2 100644 --- a/crates/subspace-networking/src/protocols/request_response/handlers/segment_header.rs +++ b/crates/subspace-networking/src/protocols/request_response/handlers/segment_header.rs @@ -15,7 +15,9 @@ pub enum SegmentHeaderRequest { /// Segment indexes to get. segment_indexes: Vec, }, - /// Defines how many segment headers to return. + // TODO: Should this be changed to return segments in normal order once we can introduce + // breaking changes? + /// Defines how many segment headers to return, segments will be in reverse order. LastSegmentHeaders { /// Number of segment headers to return. // TODO: Replace u64 with a smaller type when able to make breaking changes