From ec52183409e00bbd0a749f990582d4a372b88a1c Mon Sep 17 00:00:00 2001 From: Franco Barpp Gomes Date: Fri, 17 May 2024 07:31:55 -0300 Subject: [PATCH] fix: Read lock client on SubscribeNewHead --- core/safeclient/client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/safeclient/client.go b/core/safeclient/client.go index 211885fb..1c96a5ee 100644 --- a/core/safeclient/client.go +++ b/core/safeclient/client.go @@ -446,6 +446,9 @@ func (c *SafeEthClient) triggerReinit() { } func (c *SafeEthClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) { + c.clientLock.RLock() + defer c.clientLock.RUnlock() + sub, err := c.Client.SubscribeNewHead(ctx, ch) if err != nil { c.logger.Error("Failed to subscribe to new heads", "err", err)