• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revision767b83d2197c8d032405ba437148c569d807ffdd (tree)
Time2019-07-13 11:37:35
AuthorChengcheng Zhang <943420582@qq.c...>
CommiterChengcheng Zhang

Log Message

update init

Change Summary

Incremental Difference

--- a/cmd/vapord/commands/init.go
+++ b/cmd/vapord/commands/init.go
@@ -28,7 +28,8 @@ func init() {
2828 func initFiles(cmd *cobra.Command, args []string) {
2929 configFilePath := path.Join(config.RootDir, "config.toml")
3030 if _, err := os.Stat(configFilePath); !os.IsNotExist(err) {
31- log.WithFields(log.Fields{"module": logModule, "config": configFilePath}).Panic("Already exists config file.")
31+ log.WithFields(log.Fields{"module": logModule, "config": configFilePath}).Info("Already exists config file.")
32+ return
3233 }
3334
3435 switch config.ChainID {
@@ -44,7 +45,8 @@ func initFiles(cmd *cobra.Command, args []string) {
4445 fedFilePath := config.FederationFile()
4546 if _, err := os.Stat(fedFilePath); os.IsNotExist(err) {
4647 if err := cfg.ExportFederationFile(fedFilePath, config); err != nil {
47- log.WithFields(log.Fields{"module": logModule, "config": fedFilePath, "error": err}).Panic("fail on export federation file")
48+ log.WithFields(log.Fields{"module": logModule, "config": fedFilePath, "error": err}).Info("fail on export federation file")
49+ return
4850 }
4951 }
5052
@@ -53,11 +55,13 @@ func initFiles(cmd *cobra.Command, args []string) {
5355 if _, err := os.Stat(keyFilePath); os.IsNotExist(err) {
5456 xprv, err := chainkd.NewXPrv(nil)
5557 if err != nil {
56- log.WithFields(log.Fields{"module": logModule, "err": err}).Panic("fail on generate private key")
58+ log.WithFields(log.Fields{"module": logModule, "err": err}).Info("fail on generate private key")
59+ return
5760 }
5861
5962 if err := ioutil.WriteFile(keyFilePath, []byte(hex.EncodeToString(xprv[:])), 0600); err != nil {
60- log.WithFields(log.Fields{"module": logModule, "err": err}).Panic("fail on save private key")
63+ log.WithFields(log.Fields{"module": logModule, "err": err}).Info("fail on save private key")
64+ return
6165 }
6266
6367 log.WithFields(log.Fields{"pubkey": xprv.XPub()}).Info("success generate private")
Show on old repository browser