-
Notifications
You must be signed in to change notification settings - Fork 123
fix(l1): always use fullsync if db had data #5196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Lines of code reportTotal lines added: Detailed view |
crates/networking/p2p/sync.rs
Outdated
| debug!( | ||
| "Sync head is less than {MIN_FULL_BLOCKS} blocks away, switching to FullSync" | ||
| ); | ||
| debug!("Sync head is found switching to FullSync"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in e4dc36d
| } | ||
|
|
||
| // Update current fetch head | ||
| current_head = last_block_hash; |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in e4dc36d
| // If the sync head is not 0 we search to fullsync | ||
| let head_found = sync_head_found && store.get_latest_block_number().await? > 0; | ||
| // Or the head is very close to 0 | ||
| let head_close_to_0 = last_block_number < MIN_FULL_BLOCKS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This skips snap-syncing when we have a few blocks in the DB, while the old logic compared the distance between head and sync-head.
Edit: this skips snap-syncing when the sync-head's block number is less than 10000
**Motivation** When the db had data, we should fullsync, not override the user's data **Description** - Changes the fullsync option instead of snap to be any number instead of `MIN_FULL_BLOCKS`
Motivation
When the db had data, we should fullsync, not override the user's data
Description
MIN_FULL_BLOCKS