add error check when creating db

pull/539/head
Minh Doan 6 years ago committed by Minh Doan
parent 901e7f884f
commit 8db0e3a003
  1. 8
      cmd/harmony/main.go

@ -133,9 +133,13 @@ func createGlobalConfig() *nodeconfig.ConfigType {
}
// Initialize leveldb for main blockchain and beacon.
nodeConfig.MainDB, _ = InitLDBDatabase(*ip, *port, *freshDB, false)
if nodeConfig.MainDB, err = InitLDBDatabase(*ip, *port, *freshDB, false); err != nil {
panic(err)
}
if !*isBeacon {
nodeConfig.BeaconDB, _ = InitLDBDatabase(*ip, *port, *freshDB, true)
if nodeConfig.BeaconDB, err = InitLDBDatabase(*ip, *port, *freshDB, true); err != nil {
panic(err)
}
}
nodeConfig.SelfPeer = p2p.Peer{IP: *ip, Port: *port, ValidatorID: -1, BlsPubKey: nodeConfig.BlsPubKey}

Loading…
Cancel
Save