mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 20:50:05 +00:00
Revert "Use Less Intensive Search" (#6899)
* Revert "Use Less Intensive Search (#6848)"
This reverts commit 69e0e302b3
.
This commit is contained in:
parent
440d3288d5
commit
64ba3c076b
@ -47,7 +47,6 @@ go_library(
|
|||||||
"//shared/featureconfig:go_default_library",
|
"//shared/featureconfig:go_default_library",
|
||||||
"//shared/hashutil:go_default_library",
|
"//shared/hashutil:go_default_library",
|
||||||
"//shared/iputils:go_default_library",
|
"//shared/iputils:go_default_library",
|
||||||
"//shared/mathutil:go_default_library",
|
|
||||||
"//shared/p2putils:go_default_library",
|
"//shared/p2putils:go_default_library",
|
||||||
"//shared/params:go_default_library",
|
"//shared/params:go_default_library",
|
||||||
"//shared/roughtime:go_default_library",
|
"//shared/roughtime:go_default_library",
|
||||||
|
@ -31,7 +31,6 @@ type Listener interface {
|
|||||||
Ping(*enode.Node) error
|
Ping(*enode.Node) error
|
||||||
RequestENR(*enode.Node) (*enode.Node, error)
|
RequestENR(*enode.Node) (*enode.Node, error)
|
||||||
LocalNode() *enode.LocalNode
|
LocalNode() *enode.LocalNode
|
||||||
AllNodes() []*enode.Node
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RefreshENR uses an epoch to refresh the enr entry for our node
|
// RefreshENR uses an epoch to refresh the enr entry for our node
|
||||||
@ -144,10 +143,8 @@ func (s *Service) createListener(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dv5Cfg := discover.Config{
|
dv5Cfg := discover.Config{
|
||||||
PrivateKey: privKey,
|
PrivateKey: privKey,
|
||||||
ValidSchemes: enode.ValidSchemes,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dv5Cfg.Bootnodes = []*enode.Node{}
|
dv5Cfg.Bootnodes = []*enode.Node{}
|
||||||
for _, addr := range s.cfg.Discv5BootStrapAddr {
|
for _, addr := range s.cfg.Discv5BootStrapAddr {
|
||||||
bootNode, err := enode.Parse(enode.ValidSchemes, addr)
|
bootNode, err := enode.Parse(enode.ValidSchemes, addr)
|
||||||
|
@ -25,10 +25,6 @@ import (
|
|||||||
|
|
||||||
type mockListener struct{}
|
type mockListener struct{}
|
||||||
|
|
||||||
func (mockListener) AllNodes() []*enode.Node {
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mockListener) Self() *enode.Node {
|
func (mockListener) Self() *enode.Node {
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"github.com/libp2p/go-libp2p-core/network"
|
"github.com/libp2p/go-libp2p-core/network"
|
||||||
"github.com/prysmaticlabs/go-bitfield"
|
"github.com/prysmaticlabs/go-bitfield"
|
||||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||||
"github.com/prysmaticlabs/prysm/shared/mathutil"
|
|
||||||
"github.com/prysmaticlabs/prysm/shared/params"
|
"github.com/prysmaticlabs/prysm/shared/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,12 +22,7 @@ func (s *Service) FindPeersWithSubnet(index uint64) (bool, error) {
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
iterator := s.dv5Listener.RandomNodes()
|
iterator := s.dv5Listener.RandomNodes()
|
||||||
|
nodes := enode.ReadNodes(iterator, lookupLimit)
|
||||||
// Select appropriate size for search.
|
|
||||||
maxSize := uint64(len(s.dv5Listener.AllNodes()))
|
|
||||||
min := int(mathutil.Min(maxSize, lookupLimit))
|
|
||||||
|
|
||||||
nodes := enode.ReadNodes(iterator, min)
|
|
||||||
exists := false
|
exists := false
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
if node.IP() == nil {
|
if node.IP() == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user