mirror of
https://github.com/status-im/go-waku.git
synced 2025-02-26 12:07:34 +00:00
fix: only allow adding unique topics
This commit is contained in:
parent
735c2fa0d7
commit
e0ba66791d
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user