-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
les: switch to new discv5 #21940
les: switch to new discv5 #21940
Conversation
les/enr_entry.go
Outdated
client := dnsdisc.NewClient(dnsdisc.Config{}) | ||
return client.NewIterator(eth.config.DiscoveryURLs...) | ||
forkFilter := forkid.NewFilter(eth.blockchain) | ||
return enode.Filter(it, func(n *enode.Node) bool { |
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.
I think it's nice to filter the "non-les-server" here before establishing the TCP connection.
However, I don't think it's the proper place to check the forkID. It's better to check in the
handshake because we can check the nodes found by discovery and the nodes connect
us by itself(although I'm not sure it's realistic).
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 is a filter for discovery nodes. Checking forkID at handshake is a different story, you have an open PR to do that (and it was probably my mistake that it was delayed for so long). We can add that to the new (minimal) les4 upgrade.
Discv5 nodes are totally random and need to be filtered here because we don't want to TCP dial everyone. Nodes coming from DNS are pre-filtered by the crawler but it does not hurt to check them again here.
I can't review the p2p part meaningfully, but the les part looks good to me in general. Please fix a few nitpicks |
Please fix it |
Would be nice to enable it for the les server and have a try. Run this PR in client mode, nothing found :P Because no v5 server. |
cfe73ce
to
34daa26
Compare
34daa26
to
ba27381
Compare
Now the discovery seems to work properly, my client did find my server (takes a long time though to find a single specific node because there are several thousand non-LES nodes on discv5). Hopefully the ratio will get better eventually. |
This PR enables running the new discv5 protocol in both LES client and server mode. In client mode it mixes discv5 and dnsdisc iterators (if both are enabled) and filters incoming ENRs for "les" tag and fork ID.
The old discv5 package and all references to it are removed.