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:
Prem Chaitanya Prathi 2024-01-02 18:04:43 +05:30 committed by GitHub
parent b4ba7b75d4
commit 4ef0c75ded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -478,7 +478,7 @@ func processTopics(options NodeOptions) (map[string][]string, error) {
pubSubTopicMap[pTopic.String()] = append(pubSubTopicMap[pTopic.String()], cTopic)
}
//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{}
}

View File

@ -105,7 +105,7 @@ func (a *AdminService) postV1Peer(w http.ResponseWriter, req *http.Request) {
}
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())
}

View File

@ -978,3 +978,7 @@ func GetDiscv5Option(dnsDiscoveredNodes []dnsdisc.DiscoveredNode, discv5Nodes []
return WithDiscoveryV5(port, bootnodes, autoUpdate), nil
}
func (w *WakuNode) ClusterID() uint16 {
return w.opts.clusterID
}