cmd/geth: if running a known preset, log it for convenience

This commit is contained in:
q9f 2020-04-01 19:10:08 +02:00
parent 63deca674a
commit 799499b4f6
No known key found for this signature in database
GPG key ID: E79CDFA171DC2DF9
2 changed files with 16 additions and 5 deletions

View file

@ -268,6 +268,22 @@ func prepare(ctx *cli.Context) {
ctx.GlobalSet(utils.CacheFlag.Name, strconv.Itoa(4096))
}
}
// If we're running a known preset, log it for convenience.
if ctx.GlobalIsSet(utils.LegacyTestnetFlag.Name) {
log.Info("Starting Geth on Ropsten testnet...")
log.Warn("The --testnet flag is ambiguous! Please specify one of --goerli, --rinkeby, or --ropsten.")
log.Warn("The generic --testnet flag is deprecated and will be removed in the future!")
} else if ctx.GlobalIsSet(utils.RopstenFlag.Name) {
log.Info("Starting Geth on Ropsten testnet...")
} else if ctx.GlobalIsSet(utils.RinkebyFlag.Name) {
log.Info("Starting Geth on Rinkeby testnet...")
} else if ctx.GlobalIsSet(utils.GoerliFlag.Name) {
log.Info("Starting Geth on Görli testnet...")
} else if ctx.GlobalIsSet(utils.DeveloperFlag.Name) {
log.Info("Starting Geth in ephemeral dev mode...")
} else if !ctx.GlobalIsSet(utils.NetworkIdFlag.Name) {
log.Info("Starting Geth on Ethereum mainnet...")
}
// If we're running a light client on any network, drop the cache to some meaningfully low amount
if ctx.GlobalString(utils.SyncModeFlag.Name) == "light" && !ctx.GlobalIsSet(utils.CacheFlag.Name) {
log.Info("Dropping default light client cache", "provided", ctx.GlobalInt(utils.CacheFlag.Name), "updated", 128)

View file

@ -1449,11 +1449,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
CheckExclusive(ctx, LightLegacyServFlag, LightServeFlag, SyncModeFlag, "light")
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer
if ctx.GlobalIsSet(LegacyTestnetFlag.Name) {
log.Warn("The --testnet flag is ambiguous! Please specify one of --goerli, --rinkeby, or --ropsten.")
log.Warn("The generic --testnet flag is deprecated and will be removed in the future!")
}
var ks *keystore.KeyStore
if keystores := stack.AccountManager().Backends(keystore.KeyStoreType); len(keystores) > 0 {
ks = keystores[0].(*keystore.KeyStore)