Skip to content
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

eth/fetcher: drop peer if block too high #31

Merged
merged 1 commit into from
Sep 9, 2023
Merged

Conversation

0xcb9ff9
Copy link

@0xcb9ff9 0xcb9ff9 commented Sep 9, 2023

Description

synchronization stop under boundary conditions:

  • peer block too high
  • local node run in slow disk (Block execute too long)
  • local node more than 32 block

forgetHash remove peer count, but not drop peer, if notification block too high, never fetch block from the peer

func (f *BlockFetcher) forgetHash(hash common.Hash) {
// Remove all pending announces and decrement DOS counters
if announceMap, ok := f.announced[hash]; ok {
for _, announce := range announceMap {
f.announces[announce.origin]--
if f.announces[announce.origin] <= 0 {
delete(f.announces, announce.origin)
}
}
delete(f.announced, hash)
if f.announceChangeHook != nil {
f.announceChangeHook(hash, false)
}
}

@0xcb9ff9 0xcb9ff9 added the bug Something isn't working label Sep 9, 2023
@0xcb9ff9 0xcb9ff9 self-assigned this Sep 9, 2023
Copy link
Collaborator

@DarianShawn DarianShawn left a comment

Choose a reason for hiding this comment

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

LGTM

@DarianShawn DarianShawn merged commit d2ac7da into dev Sep 9, 2023
5 checks passed
@DarianShawn DarianShawn deleted the fix/drop-far-dist-peer branch September 9, 2023 07:28
github-merge-queue bot pushed a commit that referenced this pull request Nov 7, 2023
### Description

Fix: #56 

PR #31 misunderstood the synchronization logic. In the state of snapshot
synchronization, the height of the peer block should be much higher than
the local, the node should not be disconnected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants