aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r--cmd/geth/main.go43
1 files changed, 30 insertions, 13 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index df0af3e79..ba253bbeb 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -99,7 +99,15 @@ The output of this command is supposed to be machine-readable.
Usage: "import ethereum presale wallet",
},
},
- },
+ Description: `
+
+ get wallet import /path/to/my/presale.wallet
+
+will prompt for your password and imports your ether presale account.
+It can be used non-interactively with the --password option taking a
+passwordfile as argument containing the wallet password in plaintext.
+
+`},
{
Action: accountList,
Name: "account",
@@ -326,7 +334,6 @@ func console(ctx *cli.Context) {
repl := newJSRE(
ethereum,
ctx.String(utils.JSpathFlag.Name),
- ctx.String(utils.SolcPathFlag.Name),
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
true,
nil,
@@ -348,7 +355,6 @@ func execJSFiles(ctx *cli.Context) {
repl := newJSRE(
ethereum,
ctx.String(utils.JSpathFlag.Name),
- ctx.String(utils.SolcPathFlag.Name),
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
false,
nil,
@@ -364,12 +370,20 @@ func execJSFiles(ctx *cli.Context) {
func unlockAccount(ctx *cli.Context, am *accounts.Manager, account string) (passphrase string) {
var err error
// Load startup keys. XXX we are going to need a different format
- // Attempt to unlock the account
- passphrase = getPassPhrase(ctx, "", false)
+
if len(account) == 0 {
utils.Fatalf("Invalid account address '%s'", account)
}
- err = am.Unlock(common.HexToAddress(account), passphrase)
+ // Attempt to unlock the account 3 times
+ attempts := 3
+ for tries := 0; tries < attempts; tries++ {
+ msg := fmt.Sprintf("Unlocking account %s...%s | Attempt %d/%d", account[:8], account[len(account)-6:], tries+1, attempts)
+ passphrase = getPassPhrase(ctx, msg, false)
+ err = am.Unlock(common.HexToAddress(account), passphrase)
+ if err == nil {
+ break
+ }
+ }
if err != nil {
utils.Fatalf("Unlock account failed '%v'", err)
}
@@ -384,15 +398,18 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
am := eth.AccountManager()
account := ctx.GlobalString(utils.UnlockedAccountFlag.Name)
- if len(account) > 0 {
- if account == "primary" {
- primaryAcc, err := am.Primary()
- if err != nil {
- utils.Fatalf("no primary account: %v", err)
+ accounts := strings.Split(account, " ")
+ for _, account := range accounts {
+ if len(account) > 0 {
+ if account == "primary" {
+ primaryAcc, err := am.Primary()
+ if err != nil {
+ utils.Fatalf("no primary account: %v", err)
+ }
+ account = primaryAcc.Hex()
}
- account = primaryAcc.Hex()
+ unlockAccount(ctx, am, account)
}
- unlockAccount(ctx, am, account)
}
// Start auxiliary services if enabled.
if ctx.GlobalBool(utils.RPCEnabledFlag.Name) {