diff --git a/waku/v2/protocol/relay/waku_relay.go b/waku/v2/protocol/relay/waku_relay.go index a6f9a169..06fd2c28 100644 --- a/waku/v2/protocol/relay/waku_relay.go +++ b/waku/v2/protocol/relay/waku_relay.go @@ -286,8 +286,8 @@ func (w *WakuRelay) Publish(ctx context.Context, message *pb.WakuMessage, opts . return nil, errors.New("not enough peers to publish") } - w.topicsMutex.RLock() - defer w.topicsMutex.RUnlock() + w.topicsMutex.Lock() + defer w.topicsMutex.Unlock() pubSubTopic, err := w.upsertTopic(params.pubsubTopic) if err != nil {