aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-02-07 18:47:34 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-02-13 20:00:07 +0800
commitfad5eb0a87abfc12812647344a26de8a43830182 (patch)
treea679f37933a85edade15ee69b385b6705cc94043 /cmd/geth
parentb3c0e9d3ccb0bb326646aea47dda391a9552b122 (diff)
downloaddexon-fad5eb0a87abfc12812647344a26de8a43830182.tar
dexon-fad5eb0a87abfc12812647344a26de8a43830182.tar.gz
dexon-fad5eb0a87abfc12812647344a26de8a43830182.tar.bz2
dexon-fad5eb0a87abfc12812647344a26de8a43830182.tar.lz
dexon-fad5eb0a87abfc12812647344a26de8a43830182.tar.xz
dexon-fad5eb0a87abfc12812647344a26de8a43830182.tar.zst
dexon-fad5eb0a87abfc12812647344a26de8a43830182.zip
accounts, cmd, eth, internal, miner, node: wallets and HD APIs
Diffstat (limited to 'cmd/geth')
-rw-r--r--cmd/geth/accountcmd.go17
-rw-r--r--cmd/geth/main.go2
2 files changed, 12 insertions, 7 deletions
diff --git a/cmd/geth/accountcmd.go b/cmd/geth/accountcmd.go
index 3a0eb13e8..97a060e48 100644
--- a/cmd/geth/accountcmd.go
+++ b/cmd/geth/accountcmd.go
@@ -181,8 +181,13 @@ nodes.
func accountList(ctx *cli.Context) error {
stack := utils.MakeNode(ctx, clientIdentifier, gitCommit)
- for i, acct := range stack.AccountManager().Accounts() {
- fmt.Printf("Account #%d: {%x} %s\n", i, acct.Address, acct.URL)
+
+ var index int
+ for _, wallet := range stack.AccountManager().Wallets() {
+ for _, account := range wallet.Accounts() {
+ fmt.Printf("Account #%d: {%x} %s\n", index, account.Address, account.URL)
+ index++
+ }
}
return nil
}
@@ -276,7 +281,7 @@ func accountCreate(ctx *cli.Context) error {
stack := utils.MakeNode(ctx, clientIdentifier, gitCommit)
password := getPassPhrase("Your new account is locked with a password. Please give a password. Do not forget this password.", true, 0, utils.MakePasswordList(ctx))
- ks := stack.AccountManager().Backend(keystore.BackendType).(*keystore.KeyStore)
+ ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
account, err := ks.NewAccount(password)
if err != nil {
utils.Fatalf("Failed to create account: %v", err)
@@ -292,7 +297,7 @@ func accountUpdate(ctx *cli.Context) error {
utils.Fatalf("No accounts specified to update")
}
stack := utils.MakeNode(ctx, clientIdentifier, gitCommit)
- ks := stack.AccountManager().Backend(keystore.BackendType).(*keystore.KeyStore)
+ ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
account, oldPassword := unlockAccount(ctx, ks, ctx.Args().First(), 0, nil)
newPassword := getPassPhrase("Please give a new password. Do not forget this password.", true, 0, nil)
@@ -315,7 +320,7 @@ func importWallet(ctx *cli.Context) error {
stack := utils.MakeNode(ctx, clientIdentifier, gitCommit)
passphrase := getPassPhrase("", false, 0, utils.MakePasswordList(ctx))
- ks := stack.AccountManager().Backend(keystore.BackendType).(*keystore.KeyStore)
+ ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
acct, err := ks.ImportPreSaleKey(keyJson, passphrase)
if err != nil {
utils.Fatalf("%v", err)
@@ -336,7 +341,7 @@ func accountImport(ctx *cli.Context) error {
stack := utils.MakeNode(ctx, clientIdentifier, gitCommit)
passphrase := getPassPhrase("Your new account is locked with a password. Please give a password. Do not forget this password.", true, 0, utils.MakePasswordList(ctx))
- ks := stack.AccountManager().Backend(keystore.BackendType).(*keystore.KeyStore)
+ ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
acct, err := ks.ImportECDSA(key, passphrase)
if err != nil {
utils.Fatalf("Could not create the account: %v", err)
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 2c4963cac..e324802b5 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -246,7 +246,7 @@ func startNode(ctx *cli.Context, stack *node.Node) {
utils.StartNode(stack)
// Unlock any account specifically requested
- ks := stack.AccountManager().Backend(keystore.BackendType).(*keystore.KeyStore)
+ ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
passwords := utils.MakePasswordList(ctx)
accounts := strings.Split(ctx.GlobalString(utils.UnlockedAccountFlag.Name), ",")