Skip to content

Commit

Permalink
Fix nil storage config panic
Browse files Browse the repository at this point in the history
  • Loading branch information
peterlimg committed Jun 3, 2023
1 parent 8c87962 commit 6cf4396
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 5 additions & 4 deletions code/go/0chain.net/sharder/blockstore/fs_store.go
Expand Up @@ -226,10 +226,11 @@ func Init(workDir string, sViper *viper.Viper) {
basePath: basePath,
}

cViper := sViper.Sub("cache")
if cViper != nil {
bStore.cache = initCache(cViper)
if sViper != nil {
cViper := sViper.Sub("cache")
if cViper != nil {
bStore.cache = initCache(cViper)
}
}

SetupStore(bStore)
}
3 changes: 0 additions & 3 deletions code/go/0chain.net/sharder/sharder/sharder.go
Expand Up @@ -77,9 +77,6 @@ func main() {
ctx := common.GetRootContext()
initEntities(workdir)
sViper := viper.Sub("storage")
if sViper == nil {
panic("Storage config is required")
}
blockstore.Init(workdir, sViper)
serverChain := chain.NewChainFromConfig()
signatureScheme := serverChain.GetSignatureScheme()
Expand Down

0 comments on commit 6cf4396

Please sign in to comment.