diff --git a/cmd/geth/consolecmd.go b/cmd/geth/consolecmd.go index 8b32dce7dc..8773208adf 100644 --- a/cmd/geth/consolecmd.go +++ b/cmd/geth/consolecmd.go @@ -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) {