Skip to content

Commit

Permalink
Re-request failed chunks during validity sync
Browse files Browse the repository at this point in the history
Fixes #2930
If a peer can not provide a history chunk to us, because it is outdated, we properly emit the peer as outdated, however,
we also need to re-request the given chunk in order to continue syncing.
  • Loading branch information
viquezclaudio authored and jsdanielh committed Sep 25, 2024
1 parent c82ab4f commit 5d4712e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions consensus/src/sync/light/validity_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,14 @@ impl<TNetwork: Network> LightMacroSync<TNetwork> {
}
{
log::warn!(%err, %peer_id, chunk_index=request.chunk_index,block_number=request.block_number,"The peer could not provide the requested history chunk, we emit it as outdated");

// Remove the peer from the syncing process
self.validity_queue.remove_peer(&peer_id);
self.syncing_peers.remove(&peer_id);

// Re add the request to the sync queue
self.validity_queue.add_ids(vec![(request, None)]);

return Poll::Ready(Some(MacroSyncReturn::Outdated(peer_id)));
}
}
Expand Down

0 comments on commit 5d4712e

Please sign in to comment.