diff --git a/chain/stmgr/forks.go b/chain/stmgr/forks.go index 1f9977d961d..7aef03d034a 100644 --- a/chain/stmgr/forks.go +++ b/chain/stmgr/forks.go @@ -4,12 +4,15 @@ import ( "bytes" "context" "encoding/binary" + "errors" "os" "sort" "strings" "sync" "time" + "github.com/ipfs/go-datastore" + "github.com/ipfs/go-cid" "golang.org/x/xerrors" @@ -177,11 +180,15 @@ func (sm *StateManager) HandleStateForks(ctx context.Context, root cid.Cid, heig u := sm.stateMigrations[height] if u != nil && u.upgrade != nil { migCid, ok, err := u.migrationResultCache.Get(ctx, root) - if err == nil && ok { - log.Infow("CACHED migration", "height", height, "from", root, "to", migCid) - return migCid, nil - } else if err != nil { + if err == nil { + if ok { + log.Infow("CACHED migration", "height", height, "from", root, "to", migCid) + return migCid, nil + } + } else if !errors.Is(err, datastore.ErrNotFound) { log.Errorw("failed to lookup previous migration result", "err", err) + } else { + log.Debug("no cached migration found, migrating from scratch") } startTime := time.Now()