mirror of
https://github.com/logos-messaging/logos-messaging-go.git
synced 2026-01-22 07:43:08 +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