mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
5aac06f04e
* begin move * use same import path * imports * regen protos * regen * no rename * generate ssz * gaz * fmt * edit build file * imports * modify * remove generated files * remove protos * edit imports in prysm * beacon chain all builds * edit script * add generated pbs * add replace rules * license for ethereumapis protos * change visibility * fmt * update build files to gaz ignore * use proper form * edit imports * wrap block * revert scripts * revert go mod
30 lines
988 B
Go
30 lines
988 B
Go
package p2p
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
pb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// GossipTopicMappings represent the protocol ID to protobuf message type map for easy
|
|
// lookup.
|
|
var GossipTopicMappings = map[string]proto.Message{
|
|
BlockSubnetTopicFormat: &pb.SignedBeaconBlock{},
|
|
AttestationSubnetTopicFormat: &pb.Attestation{},
|
|
ExitSubnetTopicFormat: &pb.SignedVoluntaryExit{},
|
|
ProposerSlashingSubnetTopicFormat: &pb.ProposerSlashing{},
|
|
AttesterSlashingSubnetTopicFormat: &pb.AttesterSlashing{},
|
|
AggregateAndProofSubnetTopicFormat: &pb.SignedAggregateAttestationAndProof{},
|
|
}
|
|
|
|
// GossipTypeMapping is the inverse of GossipTopicMappings so that an arbitrary protobuf message
|
|
// can be mapped to a protocol ID string.
|
|
var GossipTypeMapping = make(map[reflect.Type]string, len(GossipTopicMappings))
|
|
|
|
func init() {
|
|
for k, v := range GossipTopicMappings {
|
|
GossipTypeMapping[reflect.TypeOf(v)] = k
|
|
}
|
|
}
|