diff --git a/README.md b/README.md index 1db2e8d..bd1b408 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ This repo does not accept issues. Please use 0 { + var moreLogs []ethtypes.Log + for i := range blocks { + logger.WithField("block", blocks[i]). + Debug("Getting logs from block") + + moreLogs, toBlock, err = t.getLogs(ctx, logger, blocks[i], blocks[i]) + if err != nil { + // If there's an error, we just skip this block and move on. + // If it was a block with a legitimate event, we'll eventually + // process it again, otherwise we can just skip it + continue + } + + logs = slices.Concat(logs, moreLogs) + } + + events, err = t.getEvents(ctx, logger, lastSkywayNonce, logs) + if err != nil { + return nil, err + } + } + + if len(events) == 0 { + // If we can't find any logs from the blocks we get from paloma, we + // resume to search from the last seen block + logs, toBlock, err = t.getLogs(ctx, logger, 0, 0) + if err != nil { + return nil, err + } + + events, err = t.getEvents(ctx, logger, lastSkywayNonce, logs) + if err != nil { + return nil, err + } + } + t.lastObservedBlockHeight = toBlock return events, err diff --git a/go.mod b/go.mod index 2e3374d..9bed0a8 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/jarcoal/httpmock v1.3.1 github.com/onsi/ginkgo/v2 v2.19.0 github.com/onsi/gomega v1.33.1 - github.com/palomachain/paloma/v2 v2.0.0-20241001160943-eea138b39129 + github.com/palomachain/paloma/v2 v2.3.1 github.com/roodeag/arbitrum v0.0.0-20230627104516-b95e4c8ebec0 github.com/rs/xid v1.5.0 github.com/sirupsen/logrus v1.9.3 diff --git a/go.sum b/go.sum index ad15ced..31d7d41 100644 --- a/go.sum +++ b/go.sum @@ -953,8 +953,8 @@ github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnh github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/palomachain/arb-geth v0.0.0-20230824112942-8e77a580a936 h1:fmQAgxcdYBxCZYczws/uxTVOYHZd4fNrOaoHp35HZMM= github.com/palomachain/arb-geth v0.0.0-20230824112942-8e77a580a936/go.mod h1:B2H2+2I4UiMR4hvAIaGLyYszNfSTYC8fWIw+kgfuFSQ= -github.com/palomachain/paloma/v2 v2.0.0-20241001160943-eea138b39129 h1:rn1u1p6Ro09uMz1UYJnrjgndSy5Y9rVUunSwCY2OQZs= -github.com/palomachain/paloma/v2 v2.0.0-20241001160943-eea138b39129/go.mod h1:EOa+cqEMAxZXYyvN5BOy0ysDP+3nMDgDUPvIXKzUc4g= +github.com/palomachain/paloma/v2 v2.3.1 h1:wRcRJKiafQbKXXn93qAeg0s4/EBgSs9g5nB/4RC3HLc= +github.com/palomachain/paloma/v2 v2.3.1/go.mod h1:EOa+cqEMAxZXYyvN5BOy0ysDP+3nMDgDUPvIXKzUc4g= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=