mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
cmd/utils: don't enumerate usb when --usb isn't set (#22130)
This commit is contained in:
parent
83b7c0eacb
commit
e33909649b
6 changed files with 16 additions and 6 deletions
|
|
@ -62,7 +62,8 @@ var (
|
||||||
utils.BootnodesV5Flag,
|
utils.BootnodesV5Flag,
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
utils.KeyStoreDirFlag,
|
utils.KeyStoreDirFlag,
|
||||||
//utils.NoUSBFlag,
|
utils.NoUSBFlag, // deprecated
|
||||||
|
utils.USBFlag,
|
||||||
utils.SmartCardDaemonPathFlag,
|
utils.SmartCardDaemonPathFlag,
|
||||||
//utils.EthashCacheDirFlag,
|
//utils.EthashCacheDirFlag,
|
||||||
//utils.EthashCachesInMemoryFlag,
|
//utils.EthashCachesInMemoryFlag,
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,11 @@ var (
|
||||||
Usage: "Directory for the keystore (default = inside the datadir)",
|
Usage: "Directory for the keystore (default = inside the datadir)",
|
||||||
Category: flags.AccountCategory,
|
Category: flags.AccountCategory,
|
||||||
}
|
}
|
||||||
|
USBFlag = &cli.BoolFlag{
|
||||||
|
Name: "usb",
|
||||||
|
Usage: "Enable monitoring and management of USB hardware wallets",
|
||||||
|
Category: flags.AccountCategory,
|
||||||
|
}
|
||||||
SmartCardDaemonPathFlag = &cli.StringFlag{
|
SmartCardDaemonPathFlag = &cli.StringFlag{
|
||||||
Name: "pcscdpath",
|
Name: "pcscdpath",
|
||||||
Usage: "Path to the smartcard daemon (pcscd) socket file",
|
Usage: "Path to the smartcard daemon (pcscd) socket file",
|
||||||
|
|
@ -1220,8 +1225,11 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
|
||||||
if ctx.IsSet(LightKDFFlag.Name) {
|
if ctx.IsSet(LightKDFFlag.Name) {
|
||||||
cfg.UseLightweightKDF = ctx.Bool(LightKDFFlag.Name)
|
cfg.UseLightweightKDF = ctx.Bool(LightKDFFlag.Name)
|
||||||
}
|
}
|
||||||
if ctx.IsSet(NoUSBFlag.Name) {
|
if ctx.IsSet(NoUSBFlag.Name) || cfg.NoUSB {
|
||||||
cfg.NoUSB = ctx.Bool(NoUSBFlag.Name)
|
log.Warn("Option nousb is deprecated and USB is deactivated by default. Use --usb to enable")
|
||||||
|
}
|
||||||
|
if ctx.IsSet(USBFlag.Name) {
|
||||||
|
cfg.USB = ctx.Bool(USBFlag.Name)
|
||||||
}
|
}
|
||||||
if ctx.IsSet(AnnounceTxsFlag.Name) {
|
if ctx.IsSet(AnnounceTxsFlag.Name) {
|
||||||
cfg.AnnounceTxs = ctx.Bool(AnnounceTxsFlag.Name)
|
cfg.AnnounceTxs = ctx.Bool(AnnounceTxsFlag.Name)
|
||||||
|
|
|
||||||
|
|
@ -87,8 +87,12 @@ type Config struct {
|
||||||
InsecureUnlockAllowed bool `toml:",omitempty"`
|
InsecureUnlockAllowed bool `toml:",omitempty"`
|
||||||
|
|
||||||
// NoUSB disables hardware wallet monitoring and connectivity.
|
// NoUSB disables hardware wallet monitoring and connectivity.
|
||||||
|
// Deprecated: USB monitoring is disabled by default and must be enabled explicitly.
|
||||||
NoUSB bool `toml:",omitempty"`
|
NoUSB bool `toml:",omitempty"`
|
||||||
|
|
||||||
|
// USB enables hardware wallet monitoring and connectivity.
|
||||||
|
USB bool `toml:",omitempty"`
|
||||||
|
|
||||||
// SmartCardDaemonPath is the path to the smartcard daemon's socket.
|
// SmartCardDaemonPath is the path to the smartcard daemon's socket.
|
||||||
SmartCardDaemonPath string `toml:",omitempty"`
|
SmartCardDaemonPath string `toml:",omitempty"`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,6 @@ func (d *DockerAdapter) NewNode(config *NodeConfig) (Node, error) {
|
||||||
conf.Stack.P2P.EnableMsgEvents = false
|
conf.Stack.P2P.EnableMsgEvents = false
|
||||||
conf.Stack.P2P.NoDiscovery = true
|
conf.Stack.P2P.NoDiscovery = true
|
||||||
conf.Stack.P2P.NAT = nil
|
conf.Stack.P2P.NAT = nil
|
||||||
conf.Stack.NoUSB = true
|
|
||||||
conf.Stack.Logger = log.New("node.id", config.ID.String())
|
conf.Stack.Logger = log.New("node.id", config.ID.String())
|
||||||
|
|
||||||
node := &DockerNode{
|
node := &DockerNode{
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,6 @@ func (e *ExecAdapter) NewNode(config *NodeConfig) (Node, error) {
|
||||||
conf.Stack.P2P.EnableMsgEvents = false
|
conf.Stack.P2P.EnableMsgEvents = false
|
||||||
conf.Stack.P2P.NoDiscovery = true
|
conf.Stack.P2P.NoDiscovery = true
|
||||||
conf.Stack.P2P.NAT = nil
|
conf.Stack.P2P.NAT = nil
|
||||||
conf.Stack.NoUSB = true
|
|
||||||
|
|
||||||
// listen on a random localhost port (we'll get the actual port after
|
// listen on a random localhost port (we'll get the actual port after
|
||||||
// starting the node through the RPC admin.nodeInfo method)
|
// starting the node through the RPC admin.nodeInfo method)
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ func (sa *SimAdapter) NewNode(config *NodeConfig) (Node, error) {
|
||||||
Dialer: sa,
|
Dialer: sa,
|
||||||
EnableMsgEvents: true,
|
EnableMsgEvents: true,
|
||||||
},
|
},
|
||||||
NoUSB: true,
|
|
||||||
Logger: log.New("node.id", id.String()),
|
Logger: log.New("node.id", id.String()),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue