From 77aa3cc6632a2b0404ad0d35e49d968a17d378cd Mon Sep 17 00:00:00 2001 From: jsvisa Date: Tue, 25 Jul 2023 15:50:43 +0800 Subject: [PATCH] eth/filters: history logs should be requested > head Signed-off-by: jsvisa --- eth/filters/api.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eth/filters/api.go b/eth/filters/api.go index 3365072725..3d93cf3cc5 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -366,6 +366,7 @@ func (api *FilterAPI) histLogs(notifier notifier, rpcSub *rpc.Subscription, from return } // Else historical logs are all delivered, let's switch to live mode + logger.Info("History logs delivery finished, and now enter into live mode", "delivered", delivered) liveOnly = true histLogs = nil case logs := <-liveLogs: @@ -441,7 +442,8 @@ func (api *FilterAPI) doHistLogs(from int64, crit FilterCriteria, histLogs chan< return errors.New("unexpected error: no header block found") } head := header.Number.Int64() - if from >= head { + if from > head { + logger.Info("Finish historical sync", "from", from, "head", head) return nil } @@ -459,7 +461,7 @@ func (api *FilterAPI) doHistLogs(from int64, crit FilterCriteria, histLogs chan< case err := <-errChan: // Range filter is done or error, let's also stop the reorgLogs subscribe if err != nil { - logger.Error("error while fetching historical logs", "err", err) + logger.Error("Error while fetching historical logs", "err", err) return err } break FORLOOP