diff options
author | obscuren <geffobscura@gmail.com> | 2014-08-22 18:12:41 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-08-22 18:12:41 +0800 |
commit | 09c7d158d1180dc9ec042b67f8c1ecb1015a142e (patch) | |
tree | 55b6e96f3e7ff3a2ab0037eda1ce56282e508f46 /utils/cmd.go | |
parent | 9131a7c65eca0951f25c7ea12865244c60090b92 (diff) | |
download | go-tangerine-09c7d158d1180dc9ec042b67f8c1ecb1015a142e.tar go-tangerine-09c7d158d1180dc9ec042b67f8c1ecb1015a142e.tar.gz go-tangerine-09c7d158d1180dc9ec042b67f8c1ecb1015a142e.tar.bz2 go-tangerine-09c7d158d1180dc9ec042b67f8c1ecb1015a142e.tar.lz go-tangerine-09c7d158d1180dc9ec042b67f8c1ecb1015a142e.tar.xz go-tangerine-09c7d158d1180dc9ec042b67f8c1ecb1015a142e.tar.zst go-tangerine-09c7d158d1180dc9ec042b67f8c1ecb1015a142e.zip |
Error window
Diffstat (limited to 'utils/cmd.go')
-rw-r--r-- | utils/cmd.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/utils/cmd.go b/utils/cmd.go index cda735c27..3f3948d60 100644 --- a/utils/cmd.go +++ b/utils/cmd.go @@ -80,6 +80,16 @@ func confirm(message string) bool { return r == "y" } +func DBSanityCheck(db ethutil.Database) error { + d, _ := db.Get([]byte("ProtocolVersion")) + protov := ethutil.NewValue(d).Uint() + if protov != eth.ProtocolVersion && protov != 0 { + return fmt.Errorf("Database version mismatch. Protocol(%d / %d). `rm -rf %s`", protov, eth.ProtocolVersion, ethutil.Config.ExecPath+"/database") + } + + return nil +} + func InitDataDir(Datadir string) { _, err := os.Stat(Datadir) if err != nil { @@ -112,7 +122,6 @@ func InitConfig(ConfigFile string, Datadir string, EnvPrefix string) *ethutil.Co func exit(err error) { status := 0 if err != nil { - fmt.Println(err) logger.Errorln("Fatal: ", err) status = 1 } |