mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
d17996f8b0
* Update V3 from V4 * Fix build v3 -> v4 * Update ssz * Update beacon_chain.pb.go * Fix formatter import * Update update-mockgen.sh comment to v4 * Fix conflicts. Pass build and tests * Fix test
29 lines
564 B
Go
29 lines
564 B
Go
package p2p
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/libp2p/go-libp2p/core/peer"
|
|
"github.com/prysmaticlabs/prysm/v4/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
|
|
}
|