From 5e0f03aacfce18dcb93711ee4e9362c7352a9438 Mon Sep 17 00:00:00 2001 From: /raw PONG _GHMoaCXLT <58883403+q9f@users.noreply.github.com> Date: Mon, 6 Apr 2020 12:06:36 +0200 Subject: [PATCH] cmd/utils: makedatadir should check for existing testnet dir --- cmd/utils/flags.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index f24dc6137a..00bbaf50e4 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -781,6 +781,12 @@ var ( func MakeDataDir(ctx *cli.Context) string { if path := ctx.GlobalString(DataDirFlag.Name); path != "" { if ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name) { + // 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) { + return legacyPath + } return filepath.Join(path, "ropsten") } if ctx.GlobalBool(RinkebyFlag.Name) {