From 41a3c112fe33e3d11cd760765f49b686c7ff4a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 4 Apr 2019 13:10:44 +0300 Subject: [PATCH] accounts, cmd/geth, internal: tiny polishes --- accounts/manager.go | 6 +++++- cmd/geth/main.go | 3 +-- internal/ethapi/api.go | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/accounts/manager.go b/accounts/manager.go index a41b63c438..3cf3422e77 100644 --- a/accounts/manager.go +++ b/accounts/manager.go @@ -24,6 +24,10 @@ import ( "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 { 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 // backends for signing transactions. 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 updaters []event.Subscription // Wallet update subscriptions for all backends updates chan WalletEvent // Subscription sink for backend wallet changes diff --git a/cmd/geth/main.go b/cmd/geth/main.go index c49caef06e..1963a1a7f8 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -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. // Print warning log to user and skip unlocking. if !stack.Config().InsecureUnlockAllowed && stack.Config().ExtRPCEnabled() { - log.Warn("Not safe to unlock account, please enable `allow-insecure-unlock` flag if necessary") - return + utils.Fatalf("Account unlock with HTTP access is forbidden!") } ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore) passwords := utils.MakePasswordList(ctx) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 178322623a..e5a8124b1f 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -322,7 +322,7 @@ func (s *PrivateAccountAPI) UnlockAccount(ctx context.Context, addr common.Addre // explicitly specifies to allow the insecure account unlocking, otherwise // it is disabled. 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)