mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 12:27:18 +00:00
Lookup Bootnode instead of Random Nodes (#3555)
* add workspace change * change to lookup bootnode
This commit is contained in:
parent
b7853f1fa8
commit
71098b6ed8
@ -97,7 +97,7 @@ func convertToMultiAddr(nodes []*enode.Node) []ma.Multiaddr {
|
||||
func convertToSingleMultiAddr(node *enode.Node) (ma.Multiaddr, error) {
|
||||
ip4 := node.IP().To4()
|
||||
if ip4 == nil {
|
||||
return nil, errors.New("node doesn't have an ip4 address")
|
||||
return nil, errors.Errorf("node doesn't have an ip4 address, it's stated IP is %s", node.IP().String())
|
||||
}
|
||||
pubkey := node.Pubkey()
|
||||
assertedKey := convertToInterfacePubkey(pubkey)
|
||||
|
@ -190,10 +190,14 @@ func (s *Service) Disconnect(pid peer.ID) error {
|
||||
// listen for new nodes watches for new nodes in the network and adds them to the peerstore.
|
||||
func (s *Service) listenForNewNodes() {
|
||||
ticker := time.NewTicker(pollingPeriod)
|
||||
bootNode, err := enode.Parse(enode.ValidSchemes, s.cfg.BootstrapNodeAddr)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
nodes := s.dv5Listener.LookupRandom()
|
||||
nodes := s.dv5Listener.Lookup(bootNode.ID())
|
||||
multiAddresses := convertToMultiAddr(nodes)
|
||||
s.connectWithAllPeers(multiAddresses)
|
||||
case <-s.ctx.Done():
|
||||
|
Loading…
Reference in New Issue
Block a user