From 1ff9c05a81be411b458a1d4869a84308b3bd1af0 Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 6 Nov 2024 15:26:11 -0800 Subject: [PATCH] Fix 'client already started' error on finding common ancestor --- zk/datastream/client/stream_client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zk/datastream/client/stream_client.go b/zk/datastream/client/stream_client.go index 6a537bb794e..e8e96ed9b29 100644 --- a/zk/datastream/client/stream_client.go +++ b/zk/datastream/client/stream_client.go @@ -128,7 +128,11 @@ func (c *StreamClient) GetL2BlockByNumber(blockNum uint64) (fullBLock *types.Ful if fullBLock, err = c.getL2BlockByNumber(blockNum); err == nil { break } - if !errors.Is(err, ErrSocket) { + + if errors.Is(err, types.ErrAlreadyStarted) { + // if the client is already started, we can stop the client and try again + c.Stop() + } else if !errors.Is(err, ErrSocket) { return nil, fmt.Errorf("getL2BlockByNumber: %w", err) }