Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
oblique committed Sep 15, 2023
1 parent 740b8a0 commit 46717d4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion node/src/exchange/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ where
let mut resps: Vec<_> = join_all(rxs)
.await
.into_iter()
// In case of HEAD all responses have only 1 header.
// This was already enforced by `decode_and_verify_responses`.
.filter_map(|v| v.ok()?.ok()?.into_iter().next())
.collect();
let mut counter: HashMap<_, usize> = HashMap::new();
Expand All @@ -164,7 +166,7 @@ where
Reverse((resp.height(), num_of_peers))
});

// Return the header with the maximum height that was received by at least 2 peers
// Return the header with the highest height that was received by at least 2 peers
for resp in &resps {
if counter[&resp.hash()] >= MIN_HEAD_RESPONSES {
respond_to.maybe_send_ok(vec![resp.to_owned()]);
Expand Down

0 comments on commit 46717d4

Please sign in to comment.