mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
eth: print db version explicitly
This commit is contained in:
parent
49c1f9cfdd
commit
3d5019b62b
1 changed files with 9 additions and 5 deletions
|
|
@ -139,16 +139,20 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
|
||||||
bloomIndexer: NewBloomIndexer(chainDb, params.BloomBitsBlocks, params.BloomConfirms),
|
bloomIndexer: NewBloomIndexer(chainDb, params.BloomBitsBlocks, params.BloomConfirms),
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Initialising Ethereum protocol", "versions", ProtocolVersions, "network", config.NetworkId)
|
bcVersion := rawdb.ReadDatabaseVersion(chainDb)
|
||||||
|
var dbVer = "<nil>"
|
||||||
|
if bcVersion != nil {
|
||||||
|
dbVer = fmt.Sprintf("%d", *bcVersion)
|
||||||
|
}
|
||||||
|
log.Info("Initialising Ethereum protocol", "versions", ProtocolVersions, "network", config.NetworkId, "dbversion", dbVer)
|
||||||
|
|
||||||
if !config.SkipBcVersionCheck {
|
if !config.SkipBcVersionCheck {
|
||||||
bcVersion := rawdb.ReadDatabaseVersion(chainDb)
|
|
||||||
if bcVersion != nil && *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)
|
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 {
|
} else if bcVersion == nil || *bcVersion < core.BlockChainVersion {
|
||||||
log.Warn("Upgrade blockchain database version", "from", *bcVersion, "to", core.BlockChainVersion)
|
log.Warn("Upgrade blockchain database version", "from", dbVer, "to", core.BlockChainVersion)
|
||||||
|
rawdb.WriteDatabaseVersion(chainDb, core.BlockChainVersion)
|
||||||
}
|
}
|
||||||
rawdb.WriteDatabaseVersion(chainDb, core.BlockChainVersion)
|
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
vmConfig = vm.Config{
|
vmConfig = vm.Config{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue