@@ -44,6 +44,32 @@ func (s *SentinelServer) BanPeer(_ context.Context, p *sentinelrpc.Peer) (*senti
44
44
return & sentinelrpc.EmptyMessage {}, nil
45
45
}
46
46
47
+ func (s * SentinelServer ) PublishGossip (_ context.Context , msg * sentinelrpc.GossipData ) (* sentinelrpc.EmptyMessage , error ) {
48
+ manager := s .sentinel .GossipManager ()
49
+ // Snappify payload before sending it to gossip
50
+ compressedData := utils .CompressSnappy (msg .Data )
51
+ var subscription * sentinel.GossipSubscription
52
+
53
+ switch msg .Type {
54
+ case sentinelrpc .GossipType_BeaconBlockGossipType :
55
+ subscription = manager .GetMatchingSubscription (string (sentinel .BeaconBlockTopic ))
56
+ case sentinelrpc .GossipType_AggregateAndProofGossipType :
57
+ subscription = manager .GetMatchingSubscription (string (sentinel .BeaconAggregateAndProofTopic ))
58
+ case sentinelrpc .GossipType_VoluntaryExitGossipType :
59
+ subscription = manager .GetMatchingSubscription (string (sentinel .VoluntaryExitTopic ))
60
+ case sentinelrpc .GossipType_ProposerSlashingGossipType :
61
+ subscription = manager .GetMatchingSubscription (string (sentinel .ProposerSlashingTopic ))
62
+ case sentinelrpc .GossipType_AttesterSlashingGossipType :
63
+ subscription = manager .GetMatchingSubscription (string (sentinel .AttesterSlashingTopic ))
64
+ default :
65
+ return & sentinelrpc.EmptyMessage {}, nil
66
+ }
67
+ if subscription == nil {
68
+ return & sentinelrpc.EmptyMessage {}, nil
69
+ }
70
+ return & sentinelrpc.EmptyMessage {}, subscription .Publish (compressedData )
71
+ }
72
+
47
73
func (s * SentinelServer ) SubscribeGossip (_ * sentinelrpc.EmptyMessage , stream sentinelrpc.Sentinel_SubscribeGossipServer ) error {
48
74
// first of all subscribe
49
75
ch , subId , err := s .gossipNotifier .addSubscriber ()
0 commit comments