aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2019-01-11 19:49:12 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-01-11 19:49:12 +0800
commitd5cad488be0069d768b358b2267cd5432b0f9a43 (patch)
tree07272f630b6486c7458c789b58bd75ff20c5480a /eth
parent2eb838ed9776c9c3ec922e1116a5d50babda31c5 (diff)
downloaddexon-d5cad488be0069d768b358b2267cd5432b0f9a43.tar.gz
dexon-d5cad488be0069d768b358b2267cd5432b0f9a43.tar.zst
dexon-d5cad488be0069d768b358b2267cd5432b0f9a43.zip
core, eth: fix database version (#18429)
* core, eth: fix database version * eth: polish error message
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 354fc17d4..2a9d56c5c 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -143,8 +143,10 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
if !config.SkipBcVersionCheck {
bcVersion := rawdb.ReadDatabaseVersion(chainDb)
- if bcVersion != core.BlockChainVersion && bcVersion != 0 {
- return nil, fmt.Errorf("Blockchain DB version mismatch (%d / %d).\n", bcVersion, core.BlockChainVersion)
+ if bcVersion != nil && *bcVersion > core.BlockChainVersion {
+ return nil, fmt.Errorf("database version is v%d, Geth %s only supports v%d", *bcVersion, params.VersionWithMeta, core.BlockChainVersion)
+ } else if bcVersion != nil && *bcVersion < core.BlockChainVersion {
+ log.Warn("Upgrade blockchain database version", "from", *bcVersion, "to", core.BlockChainVersion)
}
rawdb.WriteDatabaseVersion(chainDb, core.BlockChainVersion)
}