Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions crates/networking/p2p/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,12 @@ impl Syncer {
current_head = last_block_hash;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to revert #4985 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing in 636a594

current_head_number = last_block_number;

// If the sync head is less than 64 blocks away from our current head switch to full-sync
// If the sync head is not 0 we search to fullsync
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, if the sync head is 0 pero is less than X blocks away, we should also not do snap sync. Snap sync is for 1M blocks distance, not 100.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in e4dc36d

if sync_head_found {
let latest_block_number = store.get_latest_block_number().await?;
if last_block_number.saturating_sub(latest_block_number) < MIN_FULL_BLOCKS as u64 {
if latest_block_number != 0 {
// Too few blocks for a snap sync, switching to full sync
debug!(
"Sync head is less than {MIN_FULL_BLOCKS} blocks away, switching to FullSync"
);
debug!("Sync head is found switching to FullSync");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be an info. Also, comma missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in e4dc36d

self.snap_enabled.store(false, Ordering::Relaxed);
return self.sync_cycle_full(sync_head, store.clone()).await;
}
Expand Down
Loading