mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
accounts, cmd/geth, internal: tiny polishes
This commit is contained in:
parent
a3f494d977
commit
41a3c112fe
3 changed files with 7 additions and 4 deletions
|
|
@ -24,6 +24,10 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/event"
|
"github.com/ethereum/go-ethereum/event"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Config contains the settings of the global account manager.
|
||||||
|
//
|
||||||
|
// TODO(rjl493456442, karalabe, holiman): Get rid of this when account management
|
||||||
|
// is removed in favor of Clef.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
InsecureUnlockAllowed bool // Whether account unlocking in insecure environment is allowed
|
InsecureUnlockAllowed bool // Whether account unlocking in insecure environment is allowed
|
||||||
}
|
}
|
||||||
|
|
@ -31,7 +35,7 @@ type Config struct {
|
||||||
// Manager is an overarching account manager that can communicate with various
|
// Manager is an overarching account manager that can communicate with various
|
||||||
// backends for signing transactions.
|
// backends for signing transactions.
|
||||||
type Manager struct {
|
type Manager struct {
|
||||||
config *Config // Account manager relative configs
|
config *Config // Global account manager configurations
|
||||||
backends map[reflect.Type][]Backend // Index of backends currently registered
|
backends map[reflect.Type][]Backend // Index of backends currently registered
|
||||||
updaters []event.Subscription // Wallet update subscriptions for all backends
|
updaters []event.Subscription // Wallet update subscriptions for all backends
|
||||||
updates chan WalletEvent // Subscription sink for backend wallet changes
|
updates chan WalletEvent // Subscription sink for backend wallet changes
|
||||||
|
|
|
||||||
|
|
@ -411,8 +411,7 @@ func unlockAccounts(ctx *cli.Context, stack *node.Node) {
|
||||||
// If insecure account unlocking is not allowed if node's APIs are exposed to external.
|
// If insecure account unlocking is not allowed if node's APIs are exposed to external.
|
||||||
// Print warning log to user and skip unlocking.
|
// Print warning log to user and skip unlocking.
|
||||||
if !stack.Config().InsecureUnlockAllowed && stack.Config().ExtRPCEnabled() {
|
if !stack.Config().InsecureUnlockAllowed && stack.Config().ExtRPCEnabled() {
|
||||||
log.Warn("Not safe to unlock account, please enable `allow-insecure-unlock` flag if necessary")
|
utils.Fatalf("Account unlock with HTTP access is forbidden!")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
|
ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
|
||||||
passwords := utils.MakePasswordList(ctx)
|
passwords := utils.MakePasswordList(ctx)
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,7 @@ func (s *PrivateAccountAPI) UnlockAccount(ctx context.Context, addr common.Addre
|
||||||
// explicitly specifies to allow the insecure account unlocking, otherwise
|
// explicitly specifies to allow the insecure account unlocking, otherwise
|
||||||
// it is disabled.
|
// it is disabled.
|
||||||
if s.b.ExtRPCEnabled() && !s.b.AccountManager().Config().InsecureUnlockAllowed {
|
if s.b.ExtRPCEnabled() && !s.b.AccountManager().Config().InsecureUnlockAllowed {
|
||||||
return false, errors.New("not safe to unlock account, please enable `allow-insecure-unlock` flag if necessary")
|
return false, errors.New("account unlock with HTTP access is forbidden")
|
||||||
}
|
}
|
||||||
|
|
||||||
const max = uint64(time.Duration(math.MaxInt64) / time.Second)
|
const max = uint64(time.Duration(math.MaxInt64) / time.Second)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue