From 6f1280e704fcb00bffb59059a43e7bfc1c9e4431 Mon Sep 17 00:00:00 2001 From: Prem Chaitanya Prathi Date: Mon, 25 Mar 2024 21:03:21 +0530 Subject: [PATCH] fix: data race reported in #1070 (#1072) --- waku/v2/protocol/relay/waku_relay.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 {