prysm-pulse/cmd/prysmctl/p2p/peers.go
terence 5a66807989
Update to V5 (#13622)
* First take at updating everything to v5

* Patch gRPC gateway to use prysm v5

Fix patch

* Update go ssz

---------

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
2024-02-15 05:46:47 +00:00

29 lines
564 B
Go

package p2p
import (
"context"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p"
)
func (c *client) connectToPeers(ctx context.Context, peerMultiaddrs ...string) error {
peers, err := p2p.PeersFromStringAddrs(peerMultiaddrs)
if err != nil {
return err
}
addrInfos, err := peer.AddrInfosFromP2pAddrs(peers...)
if err != nil {
panic(err)
}
for _, info := range addrInfos {
if info.ID == c.host.ID() {
continue
}
if err := c.host.Connect(ctx, info); err != nil {
return err
}
}
return nil
}