fix: only allow adding unique topics

This commit is contained in:
Vitaliy Vlasov 2023-09-22 15:15:26 +03:00
parent 735c2fa0d7
commit e0ba66791d

View File

@ -155,6 +155,11 @@ func (ps *WakuPeerstoreImpl) AddPubSubTopic(p peer.ID, topic string) error {
if err != nil {
return err
}
for _, t := range existingTopics {
if t == topic {
return nil
}
}
existingTopics = append(existingTopics, topic)
return ps.peerStore.Put(p, peerPubSubTopics, existingTopics)
}