From 2d05235f99e7cf02af231dc8294234205d76e067 Mon Sep 17 00:00:00 2001 From: maskpp Date: Mon, 28 Aug 2023 17:21:30 +0800 Subject: [PATCH] fix bug --- internal/controller/l1_watcher.go | 4 +++- internal/controller/l2_watcher.go | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/controller/l1_watcher.go b/internal/controller/l1_watcher.go index 1df3b56..1cd2631 100644 --- a/internal/controller/l1_watcher.go +++ b/internal/controller/l1_watcher.go @@ -61,9 +61,11 @@ func (l1 *L1Watcher) ScanL1Chain(ctx context.Context) { log.Error("failed to get l1Chain start and end number", "err", err) return } + if start > end { + return + } cts := l1.contracts - err = cts.ParseL1Events(ctx, start, end) if err != nil { log.Error("failed to parse l1chain events", "start", start, "end", end, "err", err) diff --git a/internal/controller/l2_watcher.go b/internal/controller/l2_watcher.go index b0fb8c8..544480b 100644 --- a/internal/controller/l2_watcher.go +++ b/internal/controller/l2_watcher.go @@ -79,6 +79,9 @@ func (l2 *L2Watcher) ScanL2Chain(ctx context.Context) { log.Error("l2Watcher failed to get start and end number", "err", err) return } + if start > end { + return + } cts := l2.contracts err = cts.ParseL2Events(ctx, start, end)