Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
af8ada45
Commit
af8ada45
authored
May 19, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow unlocking multiple accounts #1045
Separate accounts with spaces when using --unlock
parent
46d6470c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
main.go
cmd/geth/main.go
+13
-9
No files found.
cmd/geth/main.go
View file @
af8ada45
...
@@ -364,11 +364,12 @@ func execJSFiles(ctx *cli.Context) {
...
@@ -364,11 +364,12 @@ func execJSFiles(ctx *cli.Context) {
func
unlockAccount
(
ctx
*
cli
.
Context
,
am
*
accounts
.
Manager
,
account
string
)
(
passphrase
string
)
{
func
unlockAccount
(
ctx
*
cli
.
Context
,
am
*
accounts
.
Manager
,
account
string
)
(
passphrase
string
)
{
var
err
error
var
err
error
// Load startup keys. XXX we are going to need a different format
// 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
{
if
len
(
account
)
==
0
{
utils
.
Fatalf
(
"Invalid account address '%s'"
,
account
)
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
)
err
=
am
.
Unlock
(
common
.
HexToAddress
(
account
),
passphrase
)
if
err
!=
nil
{
if
err
!=
nil
{
utils
.
Fatalf
(
"Unlock account failed '%v'"
,
err
)
utils
.
Fatalf
(
"Unlock account failed '%v'"
,
err
)
...
@@ -384,15 +385,18 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
...
@@ -384,15 +385,18 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
am
:=
eth
.
AccountManager
()
am
:=
eth
.
AccountManager
()
account
:=
ctx
.
GlobalString
(
utils
.
UnlockedAccountFlag
.
Name
)
account
:=
ctx
.
GlobalString
(
utils
.
UnlockedAccountFlag
.
Name
)
if
len
(
account
)
>
0
{
accounts
:=
strings
.
Split
(
account
,
" "
)
if
account
==
"primary"
{
for
_
,
account
:=
range
accounts
{
primaryAcc
,
err
:=
am
.
Primary
()
if
len
(
account
)
>
0
{
if
err
!=
nil
{
if
account
==
"primary"
{
utils
.
Fatalf
(
"no primary account: %v"
,
err
)
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.
// Start auxiliary services if enabled.
if
ctx
.
GlobalBool
(
utils
.
RPCEnabledFlag
.
Name
)
{
if
ctx
.
GlobalBool
(
utils
.
RPCEnabledFlag
.
Name
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment