diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 199b980eb9..e9464872b4 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -51,13 +51,10 @@ var ( // flags that configure the node nodeFlags = []cli.Flag{ utils.IdentityFlag, - utils.UnlockedAccountFlag, - utils.PasswordFileFlag, utils.BootnodesFlag, utils.BootnodesV4Flag, utils.BootnodesV5Flag, utils.DataDirFlag, - utils.KeyStoreDirFlag, utils.NoUSBFlag, utils.DashboardEnabledFlag, utils.DashboardAddrFlag, diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 9d63c68f7f..0560876006 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -69,7 +69,6 @@ var AppHelpFlagGroups = []flagGroup{ Flags: []cli.Flag{ configFileFlag, utils.DataDirFlag, - utils.KeyStoreDirFlag, utils.NoUSBFlag, utils.NetworkIdFlag, utils.TestnetFlag, @@ -135,13 +134,6 @@ var AppHelpFlagGroups = []flagGroup{ utils.TrieCacheGenFlag, }, }, - { - Name: "ACCOUNT", - Flags: []cli.Flag{ - utils.UnlockedAccountFlag, - utils.PasswordFileFlag, - }, - }, { Name: "API AND CONSOLE", Flags: []cli.Flag{ diff --git a/cmd/swarm/main.go b/cmd/swarm/main.go index ac09ae9981..d0765e4fad 100644 --- a/cmd/swarm/main.go +++ b/cmd/swarm/main.go @@ -460,7 +460,6 @@ pv(1) tool to get a progress bar: utils.NATFlag, utils.IPCDisabledFlag, utils.IPCPathFlag, - utils.PasswordFileFlag, // bzzd-specific flags CorsStringFlag, EnsAPIFlag, @@ -610,11 +609,8 @@ func getAccount(bzzaccount string, ctx *cli.Context, stack *node.Node) *ecdsa.Pr log.Info("Swarm account key loaded", "address", crypto.PubkeyToAddress(key.PublicKey)) return key } - // Otherwise try getting it from the keystore. - am := stack.AccountManager() - ks := am.Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore) - - return decryptStoreAccount(ks, bzzaccount, utils.MakePasswordList(ctx)) + utils.Fatalf(SWARM_ERR_NO_BZZACCOUNT) + return nil } // getPrivKey returns the private key of the specified bzzaccount diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index c7532dde1e..45f46e7657 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -20,7 +20,6 @@ package utils import ( "crypto/ecdsa" "fmt" - "io/ioutil" "math/big" "os" "path/filepath" @@ -343,16 +342,6 @@ var ( Usage: "Block extra data set by the miner (default = client version)", } // Account settings - UnlockedAccountFlag = cli.StringFlag{ - Name: "unlock", - Usage: "Comma separated list of accounts to unlock", - Value: "", - } - PasswordFileFlag = cli.StringFlag{ - Name: "password", - Usage: "Password file to use for non-interactive password input", - Value: "", - } ExternalSignerFlag = cli.StringFlag{ Name: "signer", Usage: "External signer (url or path to ipc file)", @@ -814,23 +803,6 @@ func setEtherbase(ctx *cli.Context, cfg *eth.Config) { } } -// MakePasswordList reads password lines from the file specified by the global --password flag. -func MakePasswordList(ctx *cli.Context) []string { - path := ctx.GlobalString(PasswordFileFlag.Name) - if path == "" { - return nil - } - text, err := ioutil.ReadFile(path) - if err != nil { - Fatalf("Failed to read password file: %v", err) - } - lines := strings.Split(string(text), "\n") - // Sanitise DOS line endings. - for i := range lines { - lines[i] = strings.TrimRight(lines[i], "\r") - } - return lines -} func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) { setNodeKey(ctx, cfg) diff --git a/console/console.go b/console/console.go index 56e03837ac..9ceabdb358 100644 --- a/console/console.go +++ b/console/console.go @@ -159,37 +159,6 @@ func (c *Console) init(preload []string) error { // Initialize the global name register (disabled for now) //c.jsre.Run(`var GlobalRegistrar = eth.contract(` + registrar.GlobalRegistrarAbi + `); registrar = GlobalRegistrar.at("` + registrar.GlobalRegistrarAddr + `");`) - // If the console is in interactive mode, instrument password related methods to query the user - if c.prompter != nil { - // Retrieve the account management object to instrument - personal, err := c.jsre.Get("personal") - if err != nil { - return err - } - // Override the openWallet, unlockAccount, newAccount and sign methods since - // these require user interaction. Assign these method in the Console the - // original web3 callbacks. These will be called by the jeth.* methods after - // they got the password from the user and send the original web3 request to - // the backend. - if obj := personal.Object(); obj != nil { // make sure the personal api is enabled over the interface - if _, err = c.jsre.Run(`jeth.openWallet = personal.openWallet;`); err != nil { - return fmt.Errorf("personal.openWallet: %v", err) - } - if _, err = c.jsre.Run(`jeth.unlockAccount = personal.unlockAccount;`); err != nil { - return fmt.Errorf("personal.unlockAccount: %v", err) - } - if _, err = c.jsre.Run(`jeth.newAccount = personal.newAccount;`); err != nil { - return fmt.Errorf("personal.newAccount: %v", err) - } - if _, err = c.jsre.Run(`jeth.sign = personal.sign;`); err != nil { - return fmt.Errorf("personal.sign: %v", err) - } - obj.Set("openWallet", bridge.OpenWallet) - obj.Set("unlockAccount", bridge.UnlockAccount) - obj.Set("newAccount", bridge.NewAccount) - obj.Set("sign", bridge.Sign) - } - } // The admin.sleep and admin.sleepBlocks are offered by the console and not by the RPC layer. admin, err := c.jsre.Get("admin") if err != nil { diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 02245128bf..b6b9503ae3 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1336,6 +1336,9 @@ func NewExternalSigner(endpoint string) (*ExternalSignerAPI, error) { } func (api *ExternalSignerAPI) signTransaction(ctx context.Context, args SendTxArgs) (*types.Transaction, error) { + if api == nil{ + return nil, errors.New("External API not initialized") + } res := SignTransactionResult{} if err := api.client.Call(&res, "account_signTransaction", args); err != nil { return nil, err @@ -1343,6 +1346,9 @@ func (api *ExternalSignerAPI) signTransaction(ctx context.Context, args SendTxAr return res.Tx, nil } func (api *ExternalSignerAPI) listAccounts() ([]common.Address, error) { + if api == nil{ + return []common.Address{}, errors.New("External API not initialized") + } var res []common.Address if err := api.client.Call(&res, "account_listAccounts"); err != nil { return nil, err @@ -1350,6 +1356,9 @@ func (api *ExternalSignerAPI) listAccounts() ([]common.Address, error) { return res, nil } func (api *ExternalSignerAPI) newAccount() (common.Address, error) { + if api == nil{ + return common.Address{}, errors.New("External API not initialized") + } var res accounts.Account if err := api.client.Call(&res, "account_new"); err != nil {