Skip to content

Commit

Permalink
fix: chain: make failure to load the chain state fatal (#11426)
Browse files Browse the repository at this point in the history
Otherwise, we get strange panics later.
  • Loading branch information
Stebalien authored Nov 29, 2023
1 parent 3d5bebc commit afa9568
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions node/modules/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ func ChainStore(lc fx.Lifecycle,
basebs dtypes.BaseBlockstore,
weight store.WeightFunc,
us stmgr.UpgradeSchedule,
j journal.Journal) *store.ChainStore {
j journal.Journal) (*store.ChainStore, error) {

chain := store.NewChainStore(cbs, sbs, ds, weight, j)

if err := chain.Load(helpers.LifecycleCtx(mctx, lc)); err != nil {
log.Warnf("loading chain state from disk: %s", err)
return nil, xerrors.Errorf("loading chain state from disk: %w", err)
}

var startHook func(context.Context) error
Expand All @@ -108,7 +108,7 @@ func ChainStore(lc fx.Lifecycle,
},
})

return chain
return chain, nil
}

func NetworkName(mctx helpers.MetricsCtx,
Expand Down

0 comments on commit afa9568

Please sign in to comment.