fix: chain: make failure to load the chain state fatal (#11426)
Otherwise, we get strange panics later.
This commit is contained in:
parent
3d5bebc2dd
commit
afa95681af
@ -82,12 +82,12 @@ func ChainStore(lc fx.Lifecycle,
|
|||||||
basebs dtypes.BaseBlockstore,
|
basebs dtypes.BaseBlockstore,
|
||||||
weight store.WeightFunc,
|
weight store.WeightFunc,
|
||||||
us stmgr.UpgradeSchedule,
|
us stmgr.UpgradeSchedule,
|
||||||
j journal.Journal) *store.ChainStore {
|
j journal.Journal) (*store.ChainStore, error) {
|
||||||
|
|
||||||
chain := store.NewChainStore(cbs, sbs, ds, weight, j)
|
chain := store.NewChainStore(cbs, sbs, ds, weight, j)
|
||||||
|
|
||||||
if err := chain.Load(helpers.LifecycleCtx(mctx, lc)); err != nil {
|
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
|
var startHook func(context.Context) error
|
||||||
@ -108,7 +108,7 @@ func ChainStore(lc fx.Lifecycle,
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
return chain
|
return chain, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NetworkName(mctx helpers.MetricsCtx,
|
func NetworkName(mctx helpers.MetricsCtx,
|
||||||
|
Loading…
Reference in New Issue
Block a user