From 701eacfedc99440d8a8cab99a8113c74b7132551 Mon Sep 17 00:00:00 2001 From: sweexordious Date: Sat, 9 Nov 2024 01:17:42 +0400 Subject: [PATCH] fix: data race --- rpc/grpc/api.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpc/grpc/api.go b/rpc/grpc/api.go index a78898b7c..0e2834e51 100644 --- a/rpc/grpc/api.go +++ b/rpc/grpc/api.go @@ -151,6 +151,8 @@ func (blockAPI *BlockAPI) retryNewBlocksSubscription(ctx context.Context) (bool, } func (blockAPI *BlockAPI) broadcastToListeners(ctx context.Context, height int64, hash []byte) { + blockAPI.Lock() + defer blockAPI.Unlock() defer func() { if r := recover(); r != nil { core.GetEnvironment().Logger.Debug("failed to write to heights listener", "err", r)