Skip to content

Commit

Permalink
Fix first subscription using non-proxy channel (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyodar authored May 24, 2024
1 parent 8048b42 commit a70030d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/safeclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,16 @@ func (c *SafeEthClient) Close() {
}

func (c *SafeEthClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) {
newSub, err := c.Client.SubscribeNewHead(ctx, ch)
proxyC := make(chan *types.Header, 100)

newSub, err := c.Client.SubscribeNewHead(ctx, proxyC)
if err != nil {
c.logger.Error("Failed to subscribe to new heads", "err", err)
return nil, err
}
c.logger.Info("Subscribed to new heads")

safeSub := NewSafeSubscription(newSub)
proxyC := make(chan *types.Header, 100)

resub := func() error {
newSub, err := c.Client.SubscribeNewHead(ctx, proxyC)
Expand Down

0 comments on commit a70030d

Please sign in to comment.