allow all drand topics

This commit is contained in:
vyzo 2020-10-08 21:48:55 +03:00
parent 4cd73f1560
commit 7933cf094f

View File

@ -187,14 +187,15 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) {
build.MessagesTopic(in.Nn): 1, build.MessagesTopic(in.Nn): 1,
} }
var drandTopic string var drandTopics []string
for _, d := range in.Dr { for _, d := range in.Dr {
drandTopic, err = getDrandTopic(d.Config.ChainInfoJSON) topic, err := getDrandTopic(d.Config.ChainInfoJSON)
if err != nil { if err != nil {
return nil, err return nil, err
} }
topicParams[drandTopic] = drandTopicParams topicParams[topic] = drandTopicParams
pgTopicWeights[drandTopic] = 5 pgTopicWeights[topic] = 5
drandTopics = append(drandTopics, topic)
} }
options := []pubsub.Option{ options := []pubsub.Option{
@ -309,13 +310,16 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) {
} }
options = append(options, pubsub.WithPeerGater(pgParams)) options = append(options, pubsub.WithPeerGater(pgParams))
allowTopics := []string{
build.BlocksTopic(in.Nn),
build.MessagesTopic(in.Nn),
}
allowTopics = append(allowTopics, drandTopics...)
options = append(options, options = append(options,
pubsub.WithSubscriptionFilter( pubsub.WithSubscriptionFilter(
pubsub.WrapLimitSubscriptionFilter( pubsub.WrapLimitSubscriptionFilter(
pubsub.NewAllowlistSubscriptionFilter( pubsub.NewAllowlistSubscriptionFilter(allowTopics...),
build.BlocksTopic(in.Nn),
build.MessagesTopic(in.Nn),
drandTopic),
100))) 100)))
// tracer // tracer