diff --git a/node/modules/ethmodule.go b/node/modules/ethmodule.go index f7f4508c4..0255b6198 100644 --- a/node/modules/ethmodule.go +++ b/node/modules/ethmodule.go @@ -4,9 +4,12 @@ import ( "context" "os" "path/filepath" + "time" "go.uber.org/fx" + "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/lotus/chain/ethhashlookup" "github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/messagepool" @@ -54,6 +57,17 @@ func EthModuleAPI(cfg config.FevmConfig) func(helpers.MetricsCtx, repo.LockedRep } } + // prefill the whole skiplist cache maintained internally by the GetTipsetByHeight + go func() { + start := time.Now() + log.Infoln("Start prefilling GetTipsetByHeight cache") + _, err := cs.GetTipsetByHeight(mctx, abi.ChainEpoch(0), cs.GetHeaviestTipSet(), false) + if err != nil { + log.Warnf("error when prefilling GetTipsetByHeight cache: %w", err) + } + log.Infof("Prefilling GetTipsetByHeight done in %s", time.Since(start)) + }() + ctx := helpers.LifecycleCtx(mctx, lc) lc.Append(fx.Hook{ OnStart: func(context.Context) error {