diff --git a/consensus/core/src/synchronizer.rs b/consensus/core/src/synchronizer.rs index e1b655e7309b0..8f3c071762233 100644 --- a/consensus/core/src/synchronizer.rs +++ b/consensus/core/src/synchronizer.rs @@ -896,7 +896,6 @@ impl Synchronizer Synchronizer>(); - info!( - "Fetching {} missing blocks from peer {}: {}", - block_refs.len(), - peer_hostname, - block_refs - .iter() - .map(|b| b.to_string()) - .collect::>() - .join(", ") - ); // lock the blocks to be fetched. If no lock can be acquired for any of the blocks then don't bother if let Some(blocks_guard) = inflight_blocks.lock_blocks(block_refs.clone(), peer) { + info!( + "Fetching {} missing blocks from peer {}: {}", + block_refs.len(), + peer_hostname, + block_refs + .iter() + .map(|b| b.to_string()) + .collect::>() + .join(", ") + ); request_futures.push(Self::fetch_blocks_request( network_client.clone(), peer, @@ -1022,9 +1021,11 @@ impl Synchronizer + Some((response, blocks_guard, _retries, peer_index, highest_rounds)) = request_futures.next() => { + let peer_hostname = &context.committee.authority(peer_index).hostname; match response { Ok(fetched_blocks) => { + info!("Fetched {} blocks from peer {}", fetched_blocks.len(), peer_hostname); results.push((blocks_guard, fetched_blocks, peer_index)); // no more pending requests are left, just break the loop @@ -1037,6 +1038,16 @@ impl Synchronizer>() + .join(", ") + ); request_futures.push(Self::fetch_blocks_request( network_client.clone(), next_peer, @@ -1052,9 +1063,10 @@ impl Synchronizer { - debug!("Timed out while fetching all the blocks"); + debug!("Timed out while fetching missing blocks"); break; } }