mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/utils: create new ropsten configurations in the ropsten datadir
This commit is contained in:
parent
fbb994cf77
commit
e81738a41b
1 changed files with 2 additions and 20 deletions
|
|
@ -781,13 +781,6 @@ 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 DatadirExists(legacyPath) {
|
||||
log.Warn("Using the deprecated `testnet` datadir. Future versions will store the Ropsten chain in `ropsten`.")
|
||||
return legacyPath
|
||||
}
|
||||
return filepath.Join(path, "ropsten")
|
||||
}
|
||||
if ctx.GlobalBool(RinkebyFlag.Name) {
|
||||
|
|
@ -1254,7 +1247,8 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) {
|
|||
// Maintain compatibility with older Geth configurations storing the
|
||||
// Ropsten database in `testnet` instead of `ropsten`.
|
||||
legacyPath := filepath.Join(node.DefaultDataDir(), "testnet")
|
||||
if DatadirExists(legacyPath) {
|
||||
if _, err := os.Stat(legacyPath); !os.IsNotExist(err) {
|
||||
log.Warn("Using the deprecated `testnet` datadir. Future versions will store the Ropsten chain in `ropsten`.")
|
||||
cfg.DataDir = legacyPath
|
||||
} else {
|
||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "ropsten")
|
||||
|
|
@ -1831,15 +1825,3 @@ func MigrateFlags(action func(ctx *cli.Context) error) func(*cli.Context) error
|
|||
return action(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// DatadirExists checks wether the datadir in `path` exists or not.
|
||||
//
|
||||
// E.g., can be used to determine wether to use the old `testnet` directory for
|
||||
// Ropsten or create a new `ropsten` datadir instead.
|
||||
func DatadirExists(path string) bool {
|
||||
if _, err := os.Stat(path); !os.IsNotExist(err) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue