mirror of
https://github.com/status-im/go-waku.git
synced 2025-02-26 20:10:44 +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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
for _, t := range existingTopics {
|
||||||
|
if t == topic {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
existingTopics = append(existingTopics, topic)
|
existingTopics = append(existingTopics, topic)
|
||||||
return ps.peerStore.Put(p, peerPubSubTopics, existingTopics)
|
return ps.peerStore.Put(p, peerPubSubTopics, existingTopics)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user