Skip to content

Commit

Permalink
fix: Read lock client on SubscribeNewHead
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyodar committed May 17, 2024
1 parent c9569bc commit ec52183
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/safeclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ec52183

Please sign in to comment.