cmd/geth: check for legacy testnet path in console command

This commit is contained in:
/raw PONG _GHMoaCXLT 2020-04-02 10:39:38 +02:00
parent 36be1022d1
commit 4bba9f7cb3
No known key found for this signature in database
GPG key ID: E79CDFA171DC2DF9

View file

@ -124,7 +124,14 @@ func remoteConsole(ctx *cli.Context) error {
}
if path != "" {
if ctx.GlobalBool(utils.LegacyTestnetFlag.Name) || ctx.GlobalBool(utils.RopstenFlag.Name) {
path = filepath.Join(path, "testnet")
// Maintain compatibility with older Geth configurations storing the
// Ropsten database in `testnet` instead of `ropsten`.
legacyPath := filepath.Join(path, "testnet")
if _, err := os.Stat(legacyPath); !os.IsNotExist(err) {
path = legacyPath
} else {
path = filepath.Join(path, "ropsten")
}
} else if ctx.GlobalBool(utils.RinkebyFlag.Name) {
path = filepath.Join(path, "rinkeby")
} else if ctx.GlobalBool(utils.GoerliFlag.Name) {