diff --git a/core/network/src/protocol/sync.rs b/core/network/src/protocol/sync.rs index 12839136a501f..a7e6139e48dd3 100644 --- a/core/network/src/protocol/sync.rs +++ b/core/network/src/protocol/sync.rs @@ -597,7 +597,14 @@ impl ChainSync { peer.state = PeerSyncState::DownloadingStale(hash); have_requests = true; Some((id.clone(), req)) - } else if let Some((range, req)) = peer_block_request(id, peer, blocks, attrs, max_parallel) { + } else if let Some((range, req)) = peer_block_request( + id, + peer, + blocks, + attrs, + max_parallel, + last_finalized + ) { peer.state = PeerSyncState::DownloadingNew(range.start); trace!( target: "sync", @@ -1236,7 +1243,11 @@ fn peer_block_request( blocks: &mut BlockCollection, attrs: &message::BlockAttributes, max_parallel_downloads: u32, + finalized: NumberFor, ) -> Option<(Range>, BlockRequest)> { + if peer.common_number < finalized { + return None; + } if let Some(range) = blocks.needed_blocks( id.clone(), MAX_BLOCKS_TO_REQUEST,