mirror of https://github.com/status-im/go-waku.git
fix: use node's clusterId when adding peer from admin REST API & don't subscribe to default pubsub topic for non-zero clusterID (#973)
This commit is contained in:
parent
b4ba7b75d4
commit
4ef0c75ded
|
@ -478,7 +478,7 @@ func processTopics(options NodeOptions) (map[string][]string, error) {
|
||||||
pubSubTopicMap[pTopic.String()] = append(pubSubTopicMap[pTopic.String()], cTopic)
|
pubSubTopicMap[pTopic.String()] = append(pubSubTopicMap[pTopic.String()], cTopic)
|
||||||
}
|
}
|
||||||
//If no topics are passed, then use default waku topic.
|
//If no topics are passed, then use default waku topic.
|
||||||
if len(pubSubTopicMap) == 0 {
|
if len(pubSubTopicMap) == 0 && options.ClusterID == 0 {
|
||||||
pubSubTopicMap[relay.DefaultWakuTopic] = []string{}
|
pubSubTopicMap[relay.DefaultWakuTopic] = []string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ func (a *AdminService) postV1Peer(w http.ResponseWriter, req *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, shard := range pInfo.Shards {
|
for _, shard := range pInfo.Shards {
|
||||||
topic := waku_proto.NewStaticShardingPubsubTopic(waku_proto.ClusterIndex, uint16(shard))
|
topic := waku_proto.NewStaticShardingPubsubTopic(a.node.ClusterID(), uint16(shard))
|
||||||
topics = append(topics, topic.String())
|
topics = append(topics, topic.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -978,3 +978,7 @@ func GetDiscv5Option(dnsDiscoveredNodes []dnsdisc.DiscoveredNode, discv5Nodes []
|
||||||
|
|
||||||
return WithDiscoveryV5(port, bootnodes, autoUpdate), nil
|
return WithDiscoveryV5(port, bootnodes, autoUpdate), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (w *WakuNode) ClusterID() uint16 {
|
||||||
|
return w.opts.clusterID
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue