mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-27 21:57:16 +00:00
61026103c6
* initial validator attesthead rewrite based on proposer rewrite * proceed with fetching committees and tree hashing the canonical head at assigned attester slot * complete filling the properties of attestation data and all associated root hashes * add when to attest todo * finish entire attester client logic * tests with mocks checked in * tests passing in client * stubbed out server implementation * fixed build due to old property * regen mocks with new mockgen version * fixed broken tests * complete bazel build fix * address some review comments * deep proto test * tests passing after checking for empty committee and crosslink root * address nishant comments
32 lines
665 B
Go
32 lines
665 B
Go
package p2p
|
|
|
|
import (
|
|
"context"
|
|
|
|
host "github.com/libp2p/go-libp2p-host"
|
|
peerstore "github.com/libp2p/go-libp2p-peerstore"
|
|
"github.com/multiformats/go-multiaddr"
|
|
"go.opencensus.io/trace"
|
|
)
|
|
|
|
// MakePeer from multiaddress string.
|
|
func MakePeer(addr string) (*peerstore.PeerInfo, error) {
|
|
maddr, err := multiaddr.NewMultiaddr(addr)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return peerstore.InfoFromP2pAddr(maddr)
|
|
}
|
|
|
|
func dialRelayNode(ctx context.Context, h host.Host, relayAddr string) error {
|
|
ctx, span := trace.StartSpan(ctx, "p2p_dialRelayNode")
|
|
defer span.End()
|
|
|
|
p, err := MakePeer(relayAddr)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return h.Connect(ctx, *p)
|
|
}
|