From 664903dc889ec295b8eea292964547dc7910a26d Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Tue, 5 Jan 2021 10:18:22 +0000 Subject: [PATCH] cmd/geth: usb is off by default (#21984) --- cmd/geth/main.go | 1 + cmd/geth/usage.go | 3 ++- cmd/utils/flags.go | 11 +++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 0d1b569b8..a2d5c36e7 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -68,6 +68,7 @@ var ( utils.KeyStoreDirFlag, utils.ExternalSignerFlag, utils.NoUSBFlag, + utils.USBFlag, utils.SmartCardDaemonPathFlag, utils.EthashCacheDirFlag, utils.EthashCachesInMemoryFlag, diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 0e70451ed..73fdcacac 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -37,7 +37,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{ utils.DataDirFlag, utils.AncientFlag, utils.KeyStoreDirFlag, - utils.NoUSBFlag, + utils.USBFlag, utils.SmartCardDaemonPathFlag, utils.NetworkIdFlag, utils.GoerliFlag, @@ -219,6 +219,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{ { Name: "ALIASED (deprecated)", Flags: append([]cli.Flag{ + utils.NoUSBFlag, utils.LegacyRPCEnabledFlag, utils.LegacyRPCListenAddrFlag, utils.LegacyRPCPortFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index c51d7916c..20b1744fd 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -119,7 +119,11 @@ var ( } NoUSBFlag = cli.BoolFlag{ Name: "nousb", - Usage: "Disables monitoring for and managing USB hardware wallets", + Usage: "Disables monitoring for and managing USB hardware wallets (deprecated)", + } + USBFlag = cli.BoolFlag{ + Name: "usb", + Usage: "Enable monitoring and management of USB hardware wallets", } SmartCardDaemonPathFlag = cli.StringFlag{ Name: "pcscdpath", @@ -1225,8 +1229,11 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) { if ctx.GlobalIsSet(LightKDFFlag.Name) { cfg.UseLightweightKDF = ctx.GlobalBool(LightKDFFlag.Name) } + if ctx.GlobalIsSet(USBFlag.Name) { + cfg.NoUSB = !ctx.GlobalBool(USBFlag.Name) + } if ctx.GlobalIsSet(NoUSBFlag.Name) { - cfg.NoUSB = ctx.GlobalBool(NoUSBFlag.Name) + log.Warn("Option nousb is deprecated and USB is deactivated by default. Use --usb to enable") } if ctx.GlobalIsSet(InsecureUnlockAllowedFlag.Name) { cfg.InsecureUnlockAllowed = ctx.GlobalBool(InsecureUnlockAllowedFlag.Name)