aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/main.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-05-20 02:40:41 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-05-20 02:40:41 +0800
commitaf8ada45e7d98527a21049e06a8bda307a083301 (patch)
tree8a0a3bc5013dd0ec2b9792687a9d2a30dd5d8b23 /cmd/geth/main.go
parent46d6470c435735d839d695da31a0823176790efe (diff)
downloadgo-tangerine-af8ada45e7d98527a21049e06a8bda307a083301.tar
go-tangerine-af8ada45e7d98527a21049e06a8bda307a083301.tar.gz
go-tangerine-af8ada45e7d98527a21049e06a8bda307a083301.tar.bz2
go-tangerine-af8ada45e7d98527a21049e06a8bda307a083301.tar.lz
go-tangerine-af8ada45e7d98527a21049e06a8bda307a083301.tar.xz
go-tangerine-af8ada45e7d98527a21049e06a8bda307a083301.tar.zst
go-tangerine-af8ada45e7d98527a21049e06a8bda307a083301.zip
Allow unlocking multiple accounts #1045
Separate accounts with spaces when using --unlock
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r--cmd/geth/main.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index df0af3e79..28a558d68 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -364,11 +364,12 @@ 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)
}
+ // Attempt to unlock the account
+ passphrase = getPassPhrase(ctx, "Unlocking account "+account, false)
err = am.Unlock(common.HexToAddress(account), passphrase)
if err != nil {
utils.Fatalf("Unlock account failed '%v'", err)
@@ -384,15 +385,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) {