p2p/discover: add initial discovery v5 implementation (#20750)
This adds an implementation of the current discovery v5 spec. There is full integration with cmd/devp2p and enode.Iterator in this version. In theory we could enable the new protocol as a replacement of discovery v4 at any time. In practice, there will likely be a few more changes to the spec and implementation before this can happen.
This commit is contained in:
@ -424,6 +424,10 @@ func (tab *Table) len() (n int) {
|
||||
// bucket returns the bucket for the given node ID hash.
|
||||
func (tab *Table) bucket(id enode.ID) *bucket {
|
||||
d := enode.LogDist(tab.self().ID(), id)
|
||||
return tab.bucketAtDistance(d)
|
||||
}
|
||||
|
||||
func (tab *Table) bucketAtDistance(d int) *bucket {
|
||||
if d <= bucketMinDistance {
|
||||
return tab.buckets[0]
|
||||
}
|
||||
|
Reference in New Issue
Block a user