mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
81f868bd48
* checkpoint * checkpoint * varint prefix for ssz * move the encoding API around a little bit to support reader writer * add a simple test for the happy path subscribe * move wait timeout to testutil * Add inverted topic mapping * Add varint prefixing to ssz network encoder * fix spacing * fix comments * fix comments * make anon methods more clear * clean up log fields * move topic mapping, reformat TODOs, get ready for brutal team review * lint * lint * lint * Update beacon-chain/p2p/gossip_topic_mappings.go Co-Authored-By: Nishant Das <nishdas93@gmail.com> * PR feedback * PR feedback * PR feedback * PR feedback * PR feedback * Update WORKSPACE * Update WORKSPACE
29 lines
829 B
Go
29 lines
829 B
Go
package p2p
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"github.com/gogo/protobuf/proto"
|
|
pb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
|
)
|
|
|
|
// GossipTopicMappings represent the protocol ID to protobuf message type map for easy
|
|
// lookup.
|
|
var GossipTopicMappings = map[string]proto.Message{
|
|
"/eth2/beacon_block": &pb.BeaconBlock{},
|
|
"/eth2/beacon_attestation": &pb.Attestation{},
|
|
"/eth2/voluntary_exit": &pb.VoluntaryExit{},
|
|
"/eth2/proposer_slashing": &pb.ProposerSlashing{},
|
|
"/eth2/attester_slashing": &pb.AttesterSlashing{},
|
|
}
|
|
|
|
// 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)
|
|
|
|
func init() {
|
|
for k, v := range GossipTopicMappings {
|
|
GossipTypeMapping[reflect.TypeOf(v)] = k
|
|
}
|
|
}
|